Skip to content

Self-improving AI Employees for everyone

fix(cache): persisted-prefix gcTime defaults via setQueryDefaults

trohitgb9371c896a1d
diff --git a/client/src/lib/queryClient.ts b/client/src/lib/queryClient.ts
index ab524bbd..1d142c95 100644
--- a/client/src/lib/queryClient.ts
+++ b/client/src/lib/queryClient.ts
@@ -46,3 +46,27 @@ queryClient.setQueryDefaults(['nodeGroups'], {
staleTime: STALE_TIME.FOREVER,
gcTime: GC_TIME.FOREVER,
});
+
+// Credential values are persisted via PersistQueryClient (see
+// queryPersist.ts whitelist). Same hydration trap as nodeSpec: the
+// per-call FOREVER staleTime did not prevent gcTime: 5min eviction, so
+// credential panel form fields silently went blank after idle. Anchor
+// the contract at the prefix root.
+queryClient.setQueryDefaults(['credentialValues'], {
+ staleTime: STALE_TIME.FOREVER,
+ gcTime: GC_TIME.FOREVER,
+});
+
+// Skill content is immutable per backend deploy (DB seeded from SKILL.md
+// once); Master Skill editor reads via fetchQuery and consumers depend
+// on the cache surviving panel close/reopen cycles. Not persisted to
+// localStorage -- in-memory FOREVER is sufficient.
+queryClient.setQueryDefaults(['skillContent'], {
+ staleTime: STALE_TIME.FOREVER,
+ gcTime: GC_TIME.FOREVER,
+});
+
+// credentialCatalogue is intentionally NOT given a setQueryDefaults
+// override. It has its own IDB warm-start path in useCatalogueQuery.ts
+// and the per-call `gcTime: 10 * 60_000` there is a deliberate bounded-
+// memory cap (IDB hydrate restores it on next mount).
diff --git a/client/src/lib/queryPersist.ts b/client/src/lib/queryPersist.ts
index 2f806e21..cd1d61f8 100644
--- a/client/src/lib/queryPersist.ts
+++ b/client/src/lib/queryPersist.ts
@@ -59,7 +59,15 @@ export const queryPersistMaxAge = 24 * 60 * 60 * 1000;
* so a future regression to the staleTime config does not silently
* start persisting noisy keys.
*/
-const PERSISTED_KEY_PREFIXES = ['nodeSpec', 'nodeGroups', 'pluginCatalogue'];
+const PERSISTED_KEY_PREFIXES = [
+ 'nodeSpec',
+ 'nodeGroups',
+ // credentialValues: panel form fields prefilled across reloads.
+ 'credentialValues',
+ // credentialCatalogue is NOT here -- it has its own IDB warm-start in
+ // useCatalogueQuery.ts (idb-keyval) so localStorage persistence would
+ // duplicate the bytes for no benefit. skillContent stays in-memory only.
+];
export function shouldPersistQuery(query: Query): boolean {
const key = query.queryKey;