Skip to content

feat: support Solid 2 - #53

Open
ryansolid wants to merge 2 commits into
mainfrom
claude/project-thread-6z9gdr
Open

ryansolid wants to merge 2 commits into
mainfrom
claude/project-thread-6z9gdr

Conversation

@ryansolid

@ryansolid ryansolid commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Ports <Transition> and <TransitionGroup> to Solid 2.0. They are built on @solid-primitives/transition-group 2.0, which already supports Solid 2. The public API and props stay the same.

What changes for users

  • Peer dependencies are now solid-js and @solidjs/web ^2.0.0. Released as 0.4.0. Solid 1 users should stay on 0.3.x. The README says this.
  • @solid-primitives/refs is no longer a dependency. Children are resolved with children() from solid-js.
  • onAfterExit runs once the exiting element has been removed from the DOM, as the docs say. Solid 2 removes the element in the flush after done(), so the exit classes are cleaned up and onAfterExit is called from an effect after that flush, not synchronously inside done(). In outin mode the order is still: after exit, then the next element's enter.

How it works

  • Children. @solid-primitives/refs 3.0.0 resolveElements re-runs the children expression on every update, which re-creates a <For>'s rows. Every item in a <TransitionGroup> exits and enters again. This package now uses children() and filters it to elements, so kept items stay the same nodes. A matching fix for refs is a separate PR there.
  • Class names. The transition callbacks run inside the primitives' effect callbacks, and reading a memo there warns STRICT_READ_UNTRACKED. The class names are now computed in the compute half of a split render effect and stored in a plain variable. This render effect is created before the primitive's, so a changed name is applied before the transition reads it. There is no untrack.
  • exitTransition takes an optional fifth argument that defers the cleanup. Called as before, it behaves as before.

Size

Minified and brotli, with solid-js external and the primitives bundled:

Entry 0.3.0 (Solid 1) This PR
Transition 1,018 B 1,125 B
TransitionGroup 1,474 B 1,476 B
Both 1,795 B 1,784 B

48 B of the Transition growth comes from @solid-primitives/transition-group 2.0 itself (429 B to 477 B).

Tooling

  • Tests run on Vitest 5 with @solidjs/vite-plugin 3, in jsdom, plus the SSR test.
  • The demo site moved from Astro to a plain Vite app with the same two pages, because @astrojs/solid-js only supports Solid 1. pnpm dev / pnpm build:site still output to dev/dist, so the Netlify config does not change.

Tests

  • pnpm test: 6 client and 1 SSR tests pass. The new tests cover:

    • TransitionGroup enter and exit, with kept items staying the same nodes
    • appear for both components
    • changing name
    • onAfterExit running after removal

    Each test also fails if anything calls console.warn.

  • pnpm build (tsc) and tsc --noEmit are clean.

  • The demo was checked in Chromium on the dev build. Every demo transitions, no enter, exit or move classes are left behind, and there were no console warnings.

🤖 Generated with Claude Code

https://claude.ai/code/session_0117BoWLcPRMHQqsr8JNMhiw

ryansolid and others added 2 commits November 20, 2026 17:11
Port <Transition> and <TransitionGroup> to Solid 2.0 on top of
@solid-primitives/transition-group 2.0.

- Peer deps are now solid-js and @solidjs/web ^2.0.0.
- Children are resolved with solid-js children() instead of
  @solid-primitives/refs (refs 3.0.0 resolveElements re-creates the
  children on every update), so the refs dependency is dropped.
- Class names are kept current by a render effect, since the transition
  callbacks run inside the primitives' effect callbacks.
- onAfterExit and the exit class cleanup run once the element is
  removed from the DOM, which now happens in the flush after done().
- Tests run on vitest 5 with @solidjs/vite-plugin and cover
  TransitionGroup, appear and a changing name with no dev warnings.
- The Astro demo site is replaced by a plain Vite app, since Astro has
  no Solid 2 integration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWLcPRMHQqsr8JNMhiw
@ryansolid ryansolid changed the title Claude/project thread 6z9gdr feat: support Solid 2 Nov 20, 2026
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.

2 participants