Skip to content

fix(reactive): make createSelector transition-aware#2939

Open
birkskyum wants to merge 3 commits into
solidjs:mainfrom
birkskyum:fix-createselector
Open

fix(reactive): make createSelector transition-aware#2939
birkskyum wants to merge 3 commits into
solidjs:mainfrom
birkskyum:fix-createselector

Conversation

@birkskyum

@birkskyum birkskyum commented Jul 25, 2026

Copy link
Copy Markdown
Member

This is an Opus 5 solution, to this solid 1 bug that was reported in the solid-start repo

Problem

createSelector does not update its subscribers when the source changes inside a transition. The subscribed computation is silently skipped, so a <Show> or classList driven by the selector never re-renders, even though a createEffect reading the same selector fires with the correct value.

The most common way to hit this is @solidjs/router: every navigation (including setSearchParams) is wrapped in startTransition, and startTransition only creates a Transition when Scheduler || SuspenseContext is set. So any app with a <Suspense> boundary and a router-driven selector is affected. SolidStart's default template ships exactly that shape, which is why it tends to surface as "my selector broke when I added SSR".

Fixes #2940. Very likely the same underlying cause as #666.

Cause

Inside a transition, Solid tracks staleness on tState, not state. writeSignal handles this:

if (!TransitionRunning) o.state = STALE;
else o.tState = STALE;

@changeset-bot

changeset-bot Bot commented Jul 25, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0b0d724

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.

Solid v1: createSelector doesn't work with hydration

1 participant