From 0cd52238e79f85e00ba700a1ae990df5cb3f4707 Mon Sep 17 00:00:00 2001 From: Quick <31828688+Quick104@users.noreply.github.com> Date: Wed, 18 Nov 2026 20:49:05 +0000 Subject: [PATCH] fix(web): keep Interface settings editable after a failed capabilities refetch A background refetch of the settings capabilities that fails keeps the last good answer as data under an error status. The Interface settings page counted that error as unavailable and replaced its poster and menu controls with the "Couldn't load" panel, although the cached answer still said what the server supports. Count the capabilities as unavailable only when no answer has arrived; a failed settings read still closes the editors. Co-Authored-By: Claude Opus 5.5 --- web/src/contexts/UICustomizationProvider.tsx | 8 ++++++-- web/src/contexts/uiCustomizationContext.ts | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/web/src/contexts/UICustomizationProvider.tsx b/web/src/contexts/UICustomizationProvider.tsx index 868a6b64c8..d3e039b977 100644 --- a/web/src/contexts/UICustomizationProvider.tsx +++ b/web/src/contexts/UICustomizationProvider.tsx @@ -29,9 +29,13 @@ export function UICustomizationProvider({ children }: { children: ReactNode }) { capabilitiesQuery.data, ); const query = useEffectiveSettings({ keys: UI_CUSTOMIZATION_KEYS, enabled: isSupported }); + // A failed background refetch keeps the last good capabilities answer as + // `data` under an error status. That answer still says what the server + // supports, so only a missing answer makes the editors unavailable. A failed + // settings read still closes them: the editors save whole documents built + // from those values. const isUnavailable = - (!capabilitiesQuery.isLoading && - (capabilitiesQuery.isError || capabilitiesQuery.data === undefined)) || + (!capabilitiesQuery.isLoading && capabilitiesQuery.data === undefined) || (isSupported && !query.isLoading && (query.isError || query.data === undefined)); // A disabled query may still expose data cached before a server downgrade or // reconnect. Ignore it until the connected server proves support. diff --git a/web/src/contexts/uiCustomizationContext.ts b/web/src/contexts/uiCustomizationContext.ts index e5f6fceee2..2789de8c50 100644 --- a/web/src/contexts/uiCustomizationContext.ts +++ b/web/src/contexts/uiCustomizationContext.ts @@ -19,7 +19,10 @@ export interface UICustomizationValue { /** The server can merge shortcut item mutations without lost updates. */ supportsAtomicShortcuts: boolean; isLoading: boolean; - /** Capability or effective-value loading failed, so whole-document editors must stay closed. */ + /** + * No capabilities answer has arrived, or the effective-value read failed, so + * whole-document editors must stay closed. + */ isUnavailable: boolean; }