Repository navigation
feat(tanstack-router)!: Solid 2 support (0.2.0) - #4
Merged
Merged
Conversation
The Solid flavor now targets Solid 2 only: solid-js 2.x, @solidjs/web 2.x, @nativescript-community/solid-js 2.x and @tanstack/solid-router 2.x. - solid-web-shim.js stands in for @solidjs/web, binding the router's renderer helpers to the NativeScript universal renderer; template() throws a clear error pointing at defaultErrorComponent / defaultNotFoundComponent. - Library sources are plain .ts using createComponent (no JSX runtime shim). - Provider/PageRenderer/Link follow Solid 2 rules: Errored, onSettled, two-arg effects, loads and Frame navigation outside owned scopes, an explicit startTransition hook. - nativescript.vite.mjs only provides the @solidjs/web alias; apps register the TanStack router plugin in their own Vite config. - Modal routers no longer replace the app router on globalThis.__ns_router. - scrollTo is stubbed for router-core's post-render scroll reset. - Shared .d.ts chunks are included in the published files.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
NathanWalker
added a commit
that referenced
this pull request
Nov 24, 2026
The Solid flavor now targets Solid 2 only: solid-js 2.x, @solidjs/web 2.x, @nativescript-community/solid-js 2.x and @tanstack/solid-router 2.x. - solid-web-shim.js stands in for @solidjs/web, binding the router's renderer helpers to the NativeScript universal renderer; template() throws a clear error pointing at defaultErrorComponent / defaultNotFoundComponent. - Library sources are plain .ts using createComponent (no JSX runtime shim). - Provider/PageRenderer/Link follow Solid 2 rules: Errored, onSettled, two-arg effects, loads and Frame navigation outside owned scopes, an explicit startTransition hook. - nativescript.vite.mjs only provides the @solidjs/web alias; apps register the TanStack router plugin in their own Vite config. - Modal routers no longer replace the app router on globalThis.__ns_router. - scrollTo is stubbed for router-core's post-render scroll reset. - Shared .d.ts chunks are included in the published files.
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.
Stacked on #3. Ports
@nativescript/tanstack-routerto Solid 2 only and bumps it to 0.2.0. Solid 1 support is dropped.Target stack:
solid-js2.x,@solidjs/web2.x,@nativescript-community/solid-js2.x,@tanstack/solid-router>=2.0.0-rc.12. Solid 2's router is currently release-candidate only.What changed
@solidjs/webstand-in.@tanstack/solid-router2 imports its renderer helpers from@solidjs/web.solid-web-shim.jsreplaces the oldsolid-js/webshim:insert,spread,effect,memo,Dynamic, and the rest to the NativeScript universal renderer.template()throws a clear error. It only backs the router's DOM fallbacks, so the error points apps atdefaultErrorComponent/defaultNotFoundComponent.NativeScriptRouterProvider,PageRendererandLinkare plain.tsusingcreateComponent, so the jsx-runtime shim is gone.ErroredreplacesErrorBoundary,onSettledreplacesonMount, and effects take the two-argument form.startTransitionhook stands in for<Transitioner />.nativescript.vite.mjsnow only provides the anchored@solidjs/webalias.@nativescript/vite(fix: fix(vite): apply plugins from dependency nativescript.vite.mjs configs NativeScript#11669). Shipping the plugin here would also double-register it for apps that add it themselves.@tanstack/router-pluginis no longer a dependency.globalThis.__ns_router, so HMR keeps patching the live router after a modal opens.scrollTois stubbed as a no-op. router-core resets window scroll after every render and threwReferenceErroron each navigation..d.tschunks (modal-state-*.d.ts) are now included infiles; the 0.1.7 tarball was missing them.Tests
vitestall pass (80 tests in 15 files).router-provider.test.tsdrives the provider against a fake Frame;router.test.tscovers HMR router registration.route-returns-array.test.ts: its fragment-array check now lives infull-deployed-flow.render-eager-children-bug.test.ts: it covered the removed jsx-runtime shim.Verified on device
Ran the ns-solid-tanstack-router demo on an iOS 27 simulator, driving it in-process:
Frame.goBack()androuter.history.back().Routes, Frame backstack and router history stayed in sync, with no Solid diagnostics or errors.
Known follow-ups
apps/demo-solidis still the webpack Solid 1 demo and needs porting or removal.initialPath.@nativescript/viteevicts the importer chain up to the router, so a fresh router is created. Seeding it from the previous__ns_routerlocation in dev would preserve the route.