diff --git a/.changeset/blocker-replay-marker-serializable.md b/.changeset/blocker-replay-marker-serializable.md new file mode 100644 index 000000000..1bf42430b --- /dev/null +++ b/.changeset/blocker-replay-marker-serializable.md @@ -0,0 +1,5 @@ +--- +"@stackflow/plugin-blocker": patch +--- + +Use a namespaced string key instead of a `Symbol` for the internal replay marker. A `Symbol`-keyed property leaked into the recorded event log, so a captured `StackSnapshot` containing a blocked-then-proceeded navigation could not be serialized by codecs that reject symbol keys (e.g. `devalue` throws `Cannot stringify POJOs with symbolic keys`). The marker is now a plain, serializable key. diff --git a/extensions/plugin-blocker/src/blockerPlugin.ts b/extensions/plugin-blocker/src/blockerPlugin.ts index 61e0041be..4a6a39ef7 100644 --- a/extensions/plugin-blocker/src/blockerPlugin.ts +++ b/extensions/plugin-blocker/src/blockerPlugin.ts @@ -57,7 +57,7 @@ function useBlockerStore(): BlockerStore { } function replayAction( - replayMarker: symbol, + replayMarker: string, store: BlockerStore, action: NavigationAction, ) { @@ -92,7 +92,7 @@ function replayAction( } function handleBeforeNavigation( - replayMarker: symbol, + replayMarker: string, store: BlockerStore, action: NavigationAction, preventDefault: () => void, @@ -164,7 +164,7 @@ function handleBeforeNavigation( export function blockerPlugin(options?: { onError?: (error: unknown) => void; }): StackflowReactPlugin { - const replayMarker = Symbol("@@blockerReplay"); + const replayMarker = "@stackflow/plugin-blocker/replay"; const store: BlockerStore = { blockers: new Map(),