Which project does this relate to?
Start
Describe the bug
I have a route that declares a server function as loader and a notFoundComponent.
The server function throws notFound().
import { createFileRoute, notFound } from "@tanstack/react-router";
import { createServerFn } from "@tanstack/react-start";
const loaderServerFn = createServerFn().handler(() => {
throw notFound();
});
export const Route = createFileRoute("/")({
loader: async () => await loaderServerFn(),
component: RouteComponent,
notFoundComponent: NotFoundComponent,
});
function NotFoundComponent() {
return <span>NotFoundComponent</span>;
}
function RouteComponent() {
return <span>RouteComponent</span>;
}
It shows NotFoundComponent as expected when initially navigating to it. When saving the file again in VSCode and therefore triggering an hot module replacement event in the browser, the route crashes with following error:
Your Example Website or App
https://github.com/ulrichstark/tanstack-repro-isNotFound-on-hmr
Steps to Reproduce the Bug or Issue
git clone https://github.com/ulrichstark/tanstack-repro-isNotFound-on-hmr
cd tanstack-repro-isNotFound-on-hmr
npm i
npx vite
Then go to /src/routes/index.tsx and hit save to trigger hmr.
Expected behavior
NotFoundComponent should still be shown after hmr.
Screenshots or Videos
No response
Platform
- Router / Start Version: 1.134.12
Additional context
Maybe similar to #5322
Which project does this relate to?
Start
Describe the bug
I have a route that declares a server function as loader and a
notFoundComponent.The server function throws
notFound().It shows NotFoundComponent as expected when initially navigating to it. When saving the file again in VSCode and therefore triggering an hot module replacement event in the browser, the route crashes with following error:
Your Example Website or App
https://github.com/ulrichstark/tanstack-repro-isNotFound-on-hmr
Steps to Reproduce the Bug or Issue
git clone https://github.com/ulrichstark/tanstack-repro-isNotFound-on-hmr cd tanstack-repro-isNotFound-on-hmr npm i npx viteThen go to
/src/routes/index.tsxand hit save to trigger hmr.Expected behavior
NotFoundComponent should still be shown after hmr.
Screenshots or Videos
No response
Platform
Additional context
Maybe similar to #5322