From 1fe07f8d7954e86d3b43b44feb6121ee2986530a Mon Sep 17 00:00:00 2001 From: ajnart Date: Mon, 6 Jul 2026 18:07:52 +0200 Subject: [PATCH] fix(query-cache): guard against undefined result from superjson.parse on legacy cache entries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #6219 superjson.parse returns undefined when given plain JSON (stored by older versions before the superjson serializer was introduced). Without the null guard, accessing .buster on undefined throws "Cannot read properties of undefined (reading 'buster')", which is caught and logged as "Failed to hydrate query cache" — contributing to instability on upgrade. Also remove now-redundant optional chaining on persisted.clientState since persisted is guaranteed non-null at that point. --- apps/nextjs/src/app/[locale]/boards/(content)/_creator.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/nextjs/src/app/[locale]/boards/(content)/_creator.tsx b/apps/nextjs/src/app/[locale]/boards/(content)/_creator.tsx index ee45a8b35..a49b80600 100644 --- a/apps/nextjs/src/app/[locale]/boards/(content)/_creator.tsx +++ b/apps/nextjs/src/app/[locale]/boards/(content)/_creator.tsx @@ -124,8 +124,8 @@ async function QueryCacheHydration({ userId, boardId }: { userId: string; boardI if (!serialized) return null; const persisted = superjson.parse(serialized); - if (persisted.buster !== queryCacheBuster) return null; - if (!persisted?.clientState?.queries?.length) return null; + if (!persisted || persisted.buster !== queryCacheBuster) return null; + if (!persisted.clientState?.queries?.length) return null; return ; } catch (error) {