Skip to content

fix: re-subscribe to ordinary external source after a transition - #2992

Open
SnowingFox wants to merge 1 commit into
solidjs:mainfrom
SnowingFox:fix/external-source-transition-resubscribe
Open

fix: re-subscribe to ordinary external source after a transition#2992
SnowingFox wants to merge 1 commit into
solidjs:mainfrom
SnowingFox:fix/external-source-transition-resubscribe

Conversation

@SnowingFox

Copy link
Copy Markdown

Problem

A computation created while a startTransition is pending never receives more than one external update when enableExternalSource is enabled. In an app this shows up as a subtree that renders correctly, updates once, then stays stale until something else forces it to re-run.

Root cause

When ExternalSourceConfig is set, createComputation (in packages/solid/src/reactive/signal.ts) wraps the computation's fn so that a run while a transition is pending tracks the computation on a transition-scoped external source (inTransition) instead of the ordinary one. A computation created during a transition only ever has inTransition.track() called, so its ordinary source records zero dependencies. After the transition completes, triggerInTransition's .then() disposes the transition-scoped source and nothing ever re-registers the computation on the ordinary source — the external system can no longer invalidate it.

Fix

Track whether the computation has ever run through the ordinary external source. When the transition-scoped source is disposed, if it never did, fire the computation's trigger once so it re-runs through the ordinary source and re-subscribes. If the computation was disposed in the meantime the trigger is a no-op, because the computation is no longer an observer of the internal track signal.

Test

Adds a regression test to packages/solid/test/external-source.spec.ts that creates a memo inside a transition, applies two external updates, and asserts both are delivered. On main the second update is lost and the test fails.

Fixes #2953

@changeset-bot

changeset-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 619e252

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
solid-js Patch
test-integration Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

enableExternalSource: a computation created during a transition loses its external subscription after one update

1 participant