Repository navigation
docs(beforeLoad & notFoundComponents): Add note regarding notFound error thrown from beforeLoad function - #5500
Conversation
WalkthroughDocumentation updates migration from Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
|
View your CI Pipeline Execution ↗ for commit 46b6819
☁️ Nx Cloud last updated this comment at |
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-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: |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
docs/router/framework/react/guide/not-found-errors.md (1)
169-170: Simplify wording in the beforeLoad warning.The warning clearly explains the beforeLoad limitation, but "prior to" is verbose and can be simplified. Consider using "before" instead for brevity.
-> ⚠️ Throwing a notFound error in a beforeLoad method will always trigger the \_\_root notFoundComponent. Since beforeLoad methods are run before the route loader methods, there is no guarantee that any required data for layouts have successfully loaded before the error is thrown.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
docs/router/framework/react/guide/not-found-errors.md(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
docs/**/*.{md,mdx}
📄 CodeRabbit inference engine (AGENTS.md)
Use internal docs links relative to the docs/ folder (e.g., ./guide/data-loading)
Files:
docs/router/framework/react/guide/not-found-errors.md
docs/{router,start}/**
📄 CodeRabbit inference engine (AGENTS.md)
Place router docs under docs/router/ and start framework docs under docs/start/
Files:
docs/router/framework/react/guide/not-found-errors.md
🪛 LanguageTool
docs/router/framework/react/guide/not-found-errors.md
[style] ~169-~169: ‘prior to’ might be wordy. Consider a shorter alternative.
Context: ...onent. Since beforeLoad methods are run prior to the route loader methods, there is no g...
(EN_WORDINESS_PREMIUM_PRIOR_TO)
🔇 Additional comments (1)
docs/router/framework/react/guide/not-found-errors.md (1)
261-261: Update documentation link format per coding guidelines.The current link
../ssr.mduses relative path traversal. Per coding guidelines, internal docs links should be relative to the docs/ folder (e.g.,./guide/data-loading). This file is located atdocs/router/framework/react/guide/not-found-errors.md, so the link should reference the SSR documentation appropriately.Verify the correct path and update the link format:
-See [SSR guide](../ssr.md) for more information. +See [SSR guide](../ssr) for more information.
There have been a couple of issues, see #5498, #3321, #2139, etc., raised regarding this.
As per this discussion in discord, it is not currently possible to throw notFound errors in beforeLoad methods and have the nearest notFoundComponent render as with normal loader methods; it will always return the notFoundComponent on the __root route.
This PR adds a note to the documentation regarding this behaviour.
Summary by CodeRabbit
Documentation
New Features
notFoundComponentconfiguration option