-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
refactor(router-core): Process routeTree into segment tree instead of flatRoutes [WIP] #5722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
refactor(router-core): Process routeTree into segment tree instead of flatRoutes [WIP] #5722
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx affected --targets=test:eslint,test:unit,tes... |
❌ Failed | 53s | View ↗ |
nx run-many --target=build --exclude=examples/*... |
❌ Failed | 4s | View ↗ |
☁️ Nx Cloud last updated this comment at 2025-11-02 16:48:33 UTC
More templates
@tanstack/arktype-adapter
@tanstack/directive-functions-plugin
@tanstack/eslint-plugin-router
@tanstack/history
@tanstack/nitro-v2-vite-plugin
@tanstack/react-router
@tanstack/react-router-devtools
@tanstack/react-router-ssr-query
@tanstack/react-start
@tanstack/react-start-client
@tanstack/react-start-server
@tanstack/router-cli
@tanstack/router-core
@tanstack/router-devtools
@tanstack/router-devtools-core
@tanstack/router-generator
@tanstack/router-plugin
@tanstack/router-ssr-query-core
@tanstack/router-utils
@tanstack/router-vite-plugin
@tanstack/server-functions-plugin
@tanstack/solid-router
@tanstack/solid-router-devtools
@tanstack/solid-router-ssr-query
@tanstack/solid-start
@tanstack/solid-start-client
@tanstack/solid-start-server
@tanstack/start-client-core
@tanstack/start-plugin-core
@tanstack/start-server-core
@tanstack/start-static-server-functions
@tanstack/start-storage-context
@tanstack/valibot-adapter
@tanstack/virtual-file-routes
@tanstack/zod-adapter
commit: |
| + (b.prefix ? b.prefix.length * 2 : 0) | ||
| // suffix counts single | ||
| + (b.suffix ? b.suffix.length : 0) | ||
| return bScore - aScore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fallback to alphabetical if same score
| if (!wildcardMatch || (wildcardMatch.index < index)) { | ||
| wildcardMatch = { node: segment, index, skipped, depth } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
score should be on DynamicNode, used in sort above, and in here if both indices are equal.
untested, DO NOT MERGE
design exploration of a rewrite of
processRouteTreeto yield a trie-like tree of segments. This should replacepackages/router-core/src/process-route-tree.tspackages/router-core/src/path.tsgoals:
non-goals:
to-do:
/)consequences:
resolvePath) should be rewritten to avoid having 2 competing implementations ofparsePathname