Handle missing reader keybinds in metadata
The current default value fallback logic for metadata just checks if a key is missing, or if it's value is undefined. Since the keybinds are an object, a keybind that got newly added and wasn't saved to the metadata was never added with its default value to the object due to the metadata containing a "keybinds" key with an existing value
This commit is contained in:
@@ -131,8 +131,11 @@ const convertMetadataToSettings = (
|
|||||||
profiles.includes(profile) ? profile : DEFAULT_READER_PROFILE,
|
profiles.includes(profile) ? profile : DEFAULT_READER_PROFILE,
|
||||||
]),
|
]),
|
||||||
) as IReaderSettings['readingModesDefaultProfile'],
|
) as IReaderSettings['readingModesDefaultProfile'],
|
||||||
hotkeys:
|
hotkeys: {
|
||||||
jsonSaveParse<IReaderSettings['hotkeys']>((metadata.hotkeys as string) ?? '') ?? defaultSettings.hotkeys,
|
...defaultSettings.hotkeys,
|
||||||
|
...(jsonSaveParse<IReaderSettings['hotkeys']>((metadata.hotkeys as string) ?? '') ??
|
||||||
|
defaultSettings.hotkeys),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user