Property way to handle not found components with permissions
Hello, we are building an dashboard where i already handle authentication, but a user also has permissions to view certain pages or not.
This i how i thought i would handle this
There is only a slight differnce when i throw these. When i throw inside the loader the notFoundComponent of this route is rendered, when i throw the notFound function inside the beforeLoad the root notFound component is rendered.
Should i just do both checks in the loader functions, am i missing somthing or should i do a complete different approach?
2 Replies
flat-fuchsia•10mo ago
yes notFound behaves differently for
beforeLoad
and loader
seems like throwing only in loader would work for youlike-goldOP•10mo ago
Thanks! indeed im now just doing this inside the loader function,
Would be really nice if we could have something like this though
Just like the middleware Tanstack/Start is getting so we can just reuse these functions across routes