Fix/save active device only in local storage (#643)

* Save "activeDevice" in the local storage

* Set default back to for "DeviceSetting"
This commit is contained in:
schroda
2024-03-07 01:12:35 +01:00
committed by GitHub
parent c0c30163c3
commit 535cb1b359
7 changed files with 92 additions and 100 deletions

View File

@@ -6,6 +6,8 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import React from 'react';
export const DEFAULT_DEVICE = 'default';
let activeDevice = DEFAULT_DEVICE;
@@ -13,3 +15,8 @@ export const getActiveDevice = (): string => activeDevice;
export const setActiveDevice = (device: string) => {
activeDevice = device;
};
export const ActiveDevice = React.createContext<{ activeDevice: string; setActiveDevice: (device: string) => void }>({
activeDevice: DEFAULT_DEVICE,
setActiveDevice: () => {},
});

View File

@@ -37,7 +37,6 @@ const GLOBAL_METADATA_KEYS: AppMetadataKeys[] = [
// client
'devices',
'activeDevice',
];
/**

View File

@@ -26,7 +26,6 @@ export const getDefaultSettings = (): MetadataServerSettings => ({
// client
devices: [DEFAULT_DEVICE],
activeDevice: DEFAULT_DEVICE,
});
export const convertSettingsToMetadata = (