Commit e77ab36 1 parent b11adb7 commit e77ab36 Copy full SHA for e77ab36
File tree 2 files changed +7
-4
lines changed
2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ export const getConfig = (f: ({ config }: { config: Config }) => void) => {
20
20
} ) ;
21
21
} ;
22
22
23
- const deepMerge = ( target : any , source : any ) : any => {
23
+ export const deepMerge = ( target : any , source : any ) : any => {
24
24
const isObject = ( obj : any ) => obj && typeof obj === "object" ;
25
25
26
26
if ( ! isObject ( target ) || ! isObject ( source ) ) {
Original file line number Diff line number Diff line change
1
+ import { Config , deepMerge , defaultConfig } from "src/newtab/scripts/config" ;
1
2
import { fillInputs } from "src/options/scripts/utils/fill-inputs" ;
2
3
import { saveConfig } from "src/options/scripts/utils/save-config" ;
3
4
import { fixAllToggleCheckboxSections } from "src/options/scripts/utils/toggle-checkbox" ;
@@ -16,12 +17,14 @@ export const importConfigAndSave = () => {
16
17
return ;
17
18
}
18
19
19
- const parsedData = JSON . parse (
20
+ const importedConfig = JSON . parse (
20
21
JSON . parse ( decodeURIComponent ( window . atob ( dataToImport . replace ( pattern , "" ) ) ) )
21
22
) ;
22
23
23
- console . log ( "[IMPORT_DEBUG]" , parsedData ) ;
24
- fillInputs ( parsedData ) ;
24
+ const mergedConfig = deepMerge ( structuredClone ( defaultConfig ) , importedConfig ) ;
25
+
26
+ console . log ( "[IMPORT_DEBUG]" , mergedConfig ) ;
27
+ fillInputs ( mergedConfig ) ;
25
28
fixAllToggleCheckboxSections ( ) ;
26
29
27
30
saveConfig ( ) ;
You can’t perform that action at this time.
0 commit comments