From d89dc49bf90efc8a27dae1bb85ac39c10a02bb66 Mon Sep 17 00:00:00 2001 From: Dimitri POSTOLOV Date: Sat, 14 Dec 2024 12:13:04 +0800 Subject: [PATCH] found case which was not optimized --- packages/graphiql/src/GraphiQL.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/graphiql/src/GraphiQL.tsx b/packages/graphiql/src/GraphiQL.tsx index f57a961d4a..4927bc9408 100644 --- a/packages/graphiql/src/GraphiQL.tsx +++ b/packages/graphiql/src/GraphiQL.tsx @@ -373,7 +373,10 @@ export function GraphiQLInterface(props: GraphiQLInterfaceProps) { const handleClearData = () => { try { - storageContext?.clear(); + // Optional chaining inside try-catch isn't supported yet by react-compiler + if (storageContext) { + storageContext.clear(); + } setClearStorageStatus('success'); } catch { setClearStorageStatus('error');