Skip to content

Commit 7bebb72

Browse files
authored
Fix function serialization in context (#1458)
1 parent d49777f commit 7bebb72

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

.changeset/sharp-horses-explode.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"apollo-client-devtools": patch
3+
---
4+
5+
Fix serialization of functions in context

src/extension/tab/helpers.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,18 @@ function getQueryOptions(observableQuery: ObservableQuery) {
133133
delete queryOptions.nextFetchPolicy;
134134
}
135135

136+
if (queryOptions.context) {
137+
queryOptions.context = JSON.parse(
138+
JSON.stringify(queryOptions.context, (_key, value) => {
139+
if (typeof value === "function") {
140+
return `<function>`;
141+
}
142+
143+
return value;
144+
})
145+
) as Record<string, unknown>;
146+
}
147+
136148
return queryOptions;
137149
}
138150

0 commit comments

Comments
 (0)