This commit is contained in:
legop3
2025-11-18 00:09:48 -05:00
parent 7390d5c1ac
commit 5c66bbd809
4 changed files with 23 additions and 23 deletions
+17 -17
View File
@@ -98,6 +98,23 @@ export function ControlSystemProvider({ children }) {
[pipeline],
);
const persistSettings = useCallback(
(partial) => {
const merged = { ...(state.settings.data ?? {}), ...(partial ?? {}) };
const success = saveControlSettings(merged);
if (success) {
dispatch({ type: 'control/settings/loaded', payload: merged });
} else {
dispatch({
type: 'control/settings/error',
payload: new Error('Failed to save control settings'),
});
}
return success;
},
[state.settings.data],
);
const updateKeyBinding = useCallback(
(bindingId, keyValue) => {
if (!bindingId) return false;
@@ -207,23 +224,6 @@ export function ControlSystemProvider({ children }) {
dispatch({ type: 'control/settings/loaded', payload: next });
}, []);
const persistSettings = useCallback(
(partial) => {
const merged = { ...(state.settings.data ?? {}), ...(partial ?? {}) };
const success = saveControlSettings(merged);
if (success) {
dispatch({ type: 'control/settings/loaded', payload: merged });
} else {
dispatch({
type: 'control/settings/error',
payload: new Error('Failed to save control settings'),
});
}
return success;
},
[state.settings.data],
);
const contextValue = useMemo(
() => ({
state,