Skip to content

Commit 0691304

Browse files
committed
Merge branch 'feat/lab-query-plan' of github.com:graphql-hive/console into feat/lab-settings
2 parents 841acba + be46f57 commit 0691304

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

  • packages/libraries/laboratory/src/components/laboratory

packages/libraries/laboratory/src/components/laboratory/operation.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,19 @@ export const ResponseQueryPlan = ({ historyItem }: { historyItem?: LaboratoryHis
192192
const [mode, setMode] = useState<'text' | 'visual'>('text');
193193

194194
const queryPlan = useMemo(() => {
195-
const queryPlan =
196-
JSON.parse((historyItem as LaboratoryHistoryRequest)?.response ?? '{}').extensions
197-
?.queryPlan ?? {};
195+
try {
196+
const queryPlan =
197+
JSON.parse((historyItem as LaboratoryHistoryRequest)?.response ?? '{}').extensions
198+
?.queryPlan ?? {};
198199

199-
if (!queryPlan) {
200+
if (!queryPlan) {
201+
return null;
202+
}
203+
204+
return QueryPlanSchema.safeParse(queryPlan).success ? queryPlan : null;
205+
} catch {
200206
return null;
201207
}
202-
203-
return QueryPlanSchema.safeParse(queryPlan).success ? queryPlan : null;
204208
}, [historyItem]);
205209

206210
return (

0 commit comments

Comments
 (0)