Hi everyone, I have some routes that look like this:
-routes
-_panel
-sales
-route.tsx
-route.tsx
-login
-route.tsx
The above gives me a route, /sales, that is rendered nested in the _panel/route.tsx Outlet. In the sales/route.tsx loader, I am checking user roles for view access, and throwing a redirect("/login", 401). I also have the v2_errorBoundary flag enabled in the remix config.
My issue is, when I throw a redirect in my sales route, three things happen:
- The redirect doesn't complete.
- The error boundary I've placed in
_panel/route.tsxis rendered. - The redirect completes properly if I omit the status code in the
redirectand dothrow redirect("/login")!
My intuition is that the error boundary at sales/route.tsx would be rendered since that file's loader threw the error! If not that, maybe the error boundary in my login/route.tsx file should render. Is this understanding wrong?
What I want to achieve (and what I believed Remix would do) is to render the layout at panel/route.tsx and render the error boundary in the Outlet! 🤔 Please correct me if I'm going about this incorrectly! 🙏