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; }