Repository navigation
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports
<Transition>and<TransitionGroup>to Solid 2.0. They are built on@solid-primitives/transition-group2.0, which already supports Solid 2. The public API and props stay the same.What changes for users
solid-jsand@solidjs/web^2.0.0. Released as0.4.0. Solid 1 users should stay on0.3.x. The README says this.@solid-primitives/refsis no longer a dependency. Children are resolved withchildren()fromsolid-js.onAfterExitruns once the exiting element has been removed from the DOM, as the docs say. Solid 2 removes the element in the flush afterdone(), so the exit classes are cleaned up andonAfterExitis called from an effect after that flush, not synchronously insidedone(). Inoutinmode the order is still: after exit, then the next element's enter.How it works
@solid-primitives/refs3.0.0resolveElementsre-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 useschildren()and filters it to elements, so kept items stay the same nodes. A matching fix for refs is a separate PR there.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 changednameis applied before the transition reads it. There is nountrack.exitTransitiontakes an optional fifth argument that defers the cleanup. Called as before, it behaves as before.Size
Minified and brotli, with
solid-jsexternal and the primitives bundled:TransitionTransitionGroup48 B of the
Transitiongrowth comes from@solid-primitives/transition-group2.0 itself (429 B to 477 B).Tooling
@solidjs/vite-plugin3, in jsdom, plus the SSR test.@astrojs/solid-jsonly supports Solid 1.pnpm dev/pnpm build:sitestill output todev/dist, so the Netlify config does not change.Tests
pnpm test: 6 client and 1 SSR tests pass. The new tests cover:TransitionGroupenter and exit, with kept items staying the same nodesappearfor both componentsnameonAfterExitrunning after removalEach test also fails if anything calls
console.warn.pnpm build(tsc) andtsc --noEmitare 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