дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 19:25:54 +02:00
fix(settings): keep staged object settings stable across renders (#293)
Settings › HTTP Proxy crashed ("Maximum update depth exceeded") when switching to No proxy or Manual. useSetting selected stagedValue() inside the zustand selector; for an object key ("proxy") whose child keys are staged separately ("proxy.mode", "proxy.host"), stagedValue builds a new merged object on every call, so the snapshot was never stable. useSetting now reuses useStagedValue, which selects base and staged separately and memoises the merge — covering every useSetting on an object-valued key. No other selector calls stagedValue.
Fixes #285
Цей коміт міститься в:
1 джерело
aeec0e6759
коміт
c3b3534f08
2 files changed
+34
-2
No files matched your search
@@ -19,7 +19,7 @@ export function usePageContext(): PageContextValue {
|
||||
export function useSetting<T>(key: string, scopeOverride?: Scope): [T, (value: T) => void] {
|
||||
const { pageId, scope: pageScope } = usePageContext();
|
||||
const scope = scopeOverride ?? pageScope;
|
||||
const value = useSettingsDialog((s) => stagedValue(s, scope, key)) as T;
|
||||
const value = useStagedValue(scope, key) as T;
|
||||
const set = useCallback((v: T) => stage(pageId, scope, key, v), [pageId, scope, key]);
|
||||
return [value, set];
|
||||
}
|
||||
|
||||
Reference in new issue
Заблокувати користувача