Open srod opened 3 days ago
This issue also happens in this very simple case :
npx create-remix@latest
export default function TestPage() { return <div>Test</div>; }
useEffect(() => { navigate("/test"); }, []);
Note : if navigate(...)
is wrapped in a function called on a button click, it works.
EDIT : The issue only happens when running the project with npm run dev
. After using npm run build
& npm run start
, it works fine.
EDIT2 : After disabling Strict Mode, it works fine with dev as well.
Reproduction
I'm doing a redirect in a AuthLayout (AuthLayout.tsx) according if session is true/false
And when navigating to /login I have a 404 error
Small reproduction : https://github.com/srod/remix-v3_lazyRouteDiscovery
If you go with your browser to /protected you will have that 404
Error: No routes matched location "/login" ErrorResponseImpl {status: 404, statusText: 'Not Found', internal: true, data: 'Error: No route matches URL "/login"',
Discord link if needed: https://discord.com/channels/770287896669978684/1306915010701824063
System Info
Used Package Manager
npm
Expected Behavior
Navigate to /login without 404 error.
Actual Behavior
When navigate to /login we have an error.