You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(query-broadcast-client-experimental): stop leaking `postMessage` rejections as unhandled errors
6
+
7
+
`BroadcastChannel.postMessage` rejects when a query payload cannot be structured-cloned (e.g. `ReadableStream`, `File`, functions, Vue `reactive` / MobX proxies). Those rejections are now handled internally and surfaced through an optional `onBroadcastError` hook; when the hook is not provided, a development-only `console.warn` reports the offending query so cross-tab sync failures are never silent.
* proxies). Useful for routing failures to an error tracker. */
57
+
onBroadcastError?: (
58
+
error:unknown,
59
+
event: {
60
+
type:'added'|'removed'|'updated'
61
+
queryHash:string
62
+
queryKey:QueryKey
63
+
},
64
+
) =>void
52
65
}
53
66
```
54
67
@@ -59,3 +72,24 @@ The default options are:
59
72
broadcastChannel='tanstack-query',
60
73
}
61
74
```
75
+
76
+
### Handling broadcast errors
77
+
78
+
If your cache can hold values that are not structured-cloneable — such as `ReadableStream` (often coming from `Response.body` or streaming APIs), `File`, functions, or framework proxies like Vue `reactive` — the underlying `BroadcastChannel.postMessage` call will reject for that query. Cross-tab sync is skipped for that query; the rest of the cache continues to broadcast normally.
79
+
80
+
By default, a `console.warn` is emitted in development so failures are never silent. Provide `onBroadcastError` to route the failure to your own error tracker:
0 commit comments