mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 09:31:20 -04:00
fullscreen prompt cookie saving, and more...
This commit is contained in:
@@ -30,9 +30,10 @@ export function SettingsProvider({ children }) {
|
||||
|
||||
const setNamespace = useCallback((namespace, updater) => {
|
||||
setState((prev) => {
|
||||
const current = prev.data[namespace] || {};
|
||||
const baseData = prev.status === 'ready' ? prev.data : loadSettings() ?? {};
|
||||
const current = baseData[namespace] || {};
|
||||
const nextValue = typeof updater === 'function' ? updater(current) : { ...current, ...(updater ?? {}) };
|
||||
const nextData = { ...prev.data, [namespace]: nextValue };
|
||||
const nextData = { ...baseData, [namespace]: nextValue };
|
||||
const success = saveSettings(nextData);
|
||||
if (!success) {
|
||||
return { ...prev, status: 'error' };
|
||||
|
||||
Reference in New Issue
Block a user