Skip to content

Commit c798c94

Browse files
committed
Fix deferred subscription replay for using keyword
The `[symDispose]()` method was clearing `_subscribers` after calling `this.f()`. With the `using _ = useSignals()` pattern, `[symDispose]` is invoked at the end of the component function scope — before React's commit phase where the `useIsomorphicLayoutEffect` replays the deferred subscriptions. This wiped the captured subscribers before they could be replayed, so signals were never actually subscribed and updates were silently lost. In the managed (try/finally) path, `f()` is called instead of `[symDispose]()`, and `f()` does not clear `_subscribers` — which is why the transform path worked correctly. Stale subscribers from suspended renders are already handled by the `subscribe` cleanup (clears on unmount) and the layout effect's `_version !== -1` check (filters out dropped dependencies). Assisted-By: devx/7d7bbf25-b015-4660-ad92-7e391d7d8929
1 parent 858ef53 commit c798c94

1 file changed

Lines changed: 0 additions & 1 deletion

File tree

packages/react/runtime/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ function createEffectStore(
333333
},
334334
[symDispose]() {
335335
this.f();
336-
this._subscribers = [];
337336
},
338337
};
339338

0 commit comments

Comments
 (0)