Skip to content

Keep route scan order on watcher updates - #28

Merged
ryansolid merged 1 commit into
solidjs:mainfrom
everton-dgn:fix/keep-route-scan-order
Oct 22, 2026
Merged

ryansolid merged 1 commit into
solidjs:mainfrom
everton-dgn:fix/keep-route-scan-order

Conversation

@everton-dgn

Copy link
Copy Markdown
Contributor

Fixes #27

The watcher path changed the manifest order that #14 made deterministic: _addRoute moved an updated route to the end and appended new ones.

  • _addRoute replaces an existing route in place.
  • The router records the source file that first produced each route path. A new route is inserted before the first route whose recorded source sorts after it, which is the position a full scan gives it. removeRoute drops the record.
  • _addRoute takes the source as an optional second argument. Without it, a new route is appended, as before.

This also changes the initial scan when two files map to the same path (for example about.mdx and about.tsx): the entry now keeps the position of the first file instead of moving to the end.

The new tests in test/convention.spec.ts update a route, remove and re-add it, and add files in the middle and at the end, comparing router.routes with a fresh scan after each step; a second test covers two files that map to the same path. Both fail on main.

An updated route was moved to the end of the manifest and new files were appended, so watcher events reordered the manifest and the generated types. Replace existing routes in place and insert new ones where a full scan puts them.
@ryansolid
ryansolid merged commit 76f0b50 into solidjs:main Oct 22, 2026
2 checks passed
ryansolid added a commit that referenced this pull request Oct 22, 2026
Originally #30 by @everton-dgn, with its conflict against #28 resolved.

Fixes #29

Co-authored-by: Éverton Toffanetto <58889432+everton-dgn@users.noreply.github.com>
everton-dgn added a commit to everton-dgn/boilerplate_solidjs that referenced this pull request Oct 23, 2026
Update filesystem-routing to 0.4.1, which keeps the route scan order on
watcher updates (solidjs/filesystem-routing#28) and removes watched routes
by the file that added them, so its Bun patch is dropped. The generated
route declarations now type each ref by its picked exports. The middleware
comment no longer claims that the API handler only takes a Request.

Update vite-plus and vite-plus-core to 1.4.0. The CSS Modules patch still
applies unchanged, since vitejs/vite#23736 is not in this release, and
moves to the new version key. The bundled oxlint now asks for String.raw
in the relative import restriction regex.

Update the Node runtime to the 24.22.1 security release and raise the
engine floor to match.
ryansolid pushed a commit that referenced this pull request Oct 23, 2026
From #18 by @sabercoy; the watcher-order part of that PR landed as #28.

Co-authored-by: sabercoy <sabianpugh12@gmail.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PtVqG6fjQyZv5ZnEFKdcyK
ryansolid added a commit that referenced this pull request Oct 23, 2026
From #18 by @sabercoy; the watcher-order part of that PR landed as #28.

Co-authored-by: sabercoy <sabianpugh12@gmail.com>
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.

Watcher updates move routes out of scan order

2 participants