Skip to content

feat(tanstack-router)!: Solid 2 support (0.2.0) - #4

Merged
NathanWalker merged 1 commit into
feat/extra-router-paramsfrom
feat/solid-2
Nov 24, 2026
Merged

NathanWalker merged 1 commit into
feat/extra-router-paramsfrom
feat/solid-2

Conversation

@NathanWalker

@NathanWalker NathanWalker commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #3. Ports @nativescript/tanstack-router to Solid 2 only and bumps it to 0.2.0. Solid 1 support is dropped.

Target stack: solid-js 2.x, @solidjs/web 2.x, @nativescript-community/solid-js 2.x, @tanstack/solid-router >=2.0.0-rc.12. Solid 2's router is currently release-candidate only.

What changed

  • @solidjs/web stand-in. @tanstack/solid-router 2 imports its renderer helpers from @solidjs/web. solid-web-shim.js replaces the old solid-js/web shim:
    • It binds insert, spread, effect, memo, Dynamic, and the rest to the NativeScript universal renderer.
    • It stubs the head, hydration and event-delegation APIs, which have no NativeScript equivalent.
    • template() throws a clear error. It only backs the router's DOM fallbacks, so the error points apps at defaultErrorComponent / defaultNotFoundComponent.
  • No JSX in the library. NativeScriptRouterProvider, PageRenderer and Link are plain .ts using createComponent, so the jsx-runtime shim is gone.
  • Solid 2 semantics.
    • Errored replaces ErrorBoundary, onSettled replaces onMount, and effects take the two-argument form.
    • Loads and Frame navigation run outside owned scopes, as Solid 2 requires.
    • A startTransition hook stands in for <Transitioner />.
    • Pages keep their views through the native pop animation while their reactivity is torn down.
  • Vite integration.
    • nativescript.vite.mjs now only provides the anchored @solidjs/web alias.
    • The TanStack router plugin moves to the app's own Vite config, as documented in the README. Plugins returned from dependency configs were never applied by @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-plugin is no longer a dependency.
  • Runtime fixes found on the iOS simulator.
    • Modal routers no longer overwrite the app router on globalThis.__ns_router, so HMR keeps patching the live router after a modal opens.
    • scrollTo is stubbed as a no-op. router-core resets window scroll after every render and threw ReferenceError on each navigation.
  • Packaging. Shared .d.ts chunks (modal-state-*.d.ts) are now included in files; the 0.1.7 tarball was missing them.

Tests

  • Results: typecheck, build and vitest all pass (80 tests in 15 files).
  • New: router-provider.test.ts drives the provider against a fake Frame; router.test.ts covers HMR router registration.
  • Removed:
    • route-returns-array.test.ts: its fragment-array check now lives in full-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:

  • Link taps for push, detail, modal open and modal close.
  • Native Frame.goBack() and router.history.back().
  • Nested and virtual file routes.
  • A shared-component HMR update.

Routes, Frame backstack and router history stayed in sync, with no Solid diagnostics or errors.

Known follow-ups

  • apps/demo-solid is still the webpack Solid 1 demo and needs porting or removal.
  • After an HMR edit to a shared (non-route) component, the app returns to initialPath. @nativescript/vite evicts the importer chain up to the router, so a fresh router is created. Seeding it from the previous __ns_router location in dev would preserve the route.

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.
@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e0095004-e5b4-4aec-8ad6-b743f9229ee8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@NathanWalker
NathanWalker merged commit 1e4fe72 into feat/extra-router-params Nov 24, 2026
4 checks passed
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.
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.

1 participant