-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useCatch
in root CatchBoundary
returns nested route's data if root and nested loader throw
#4791
Comments
We temporarily throw the interstitial page from within getAuth in addition to the rootAuthLoader.ts See remix-run/remix#4791 for details
We temporarily throw the interstitial page from within getAuth in addition to the rootAuthLoader.ts See remix-run/remix#4791 for details
We temporarily throw the interstitial page from within getAuth in addition to the rootAuthLoader.ts See remix-run/remix#4791 for details
Off topic, but shoutout to @nikosdouvlis for such an amazing bug report. |
@nikosdouvlis 🙌 They oughta give out awards for "best bug report" - this is fantastic! Just pushed a fix for this over in the |
Awesome! I'm glad that the report helped :) And many thanks for pushing out a fix so fast, it's highly appreciated! |
Hey @nikosdouvlis - just FYI this fix is available in a |
@xHomu Can you elaborate on your issue? Using I think whatever you're reporting is potentially a separate issue? |
@nikosdouvlis Just wanted to check back in to see if you've been able to confirm this fix on your end? There is a @xHomu Please let me know if you're still seeing anything wrong - and if it turns out to be a different cause let's open a new issue for that 👍 Thanks folks! |
Will open a separate issue if I can isolate the situation! Thanks for the hard work, @brophdawg11 ! |
What version of Remix are you using?
1.8.1
Steps to Reproduce
npx create-remix@latest
. The stack does not matter, so feel free to choose the default configuration (TS + Remix App Server).loader
fromroot.tsx
that throws a json responseroot.tsx
that renders the data returned by callinguseCatch
routes/withBoundary.tsx
. This route exports aloader
that throws a json response. It also exports a CatchBoundary.routes/withoutBoundary.tsx
. This route exports aloader
that throws a json response. It does not export a CatchBoundary.npm run dev
to start the appExpected Behavior
/
: the root CatchBoundary should render and useCatch will return the data of the root loader response./withBoundary
: the root CatchBoundary should render and useCatch will return the data of the root loader response./withoutBoundary
: the root CatchBoundary should render and useCatch will return the data of the root loader response.Actual Behavior
/
: the root CatchBoundary renders, and useCatch returns the data of the root loader response./withBoundary
: the root CatchBoundary renders and useCatch returns of the root loader response./withoutBoundary
: the root CatchBoundary renders but useCatch returns the data of the/withoutBoundary
loader response instead.More context
Hello everyone! First things first... Thanks for the fantastic work you've been doing on Remix and RR; both are a joy to use.
Clerk added support for Remix apps last February when we released the
@clerk/remix
package, receiving great feedback from our community. Our auth mechanism is based on auto-refreshing short-lived JWTs. We use the rootloader
and rootCatchBoundary
to get a fresh token if we detect a stale one.We've been investigating an issue our users reported following the Remix 1.8 release. It looks like the behavior of the
useCatch
/CatchBoundary
changed between Remix versions 1.7.6 and 1.8, breaking our integration for some specific edge cases.Maintaining OS projects is hard, so we hope the "Debugging" and "Reproducible examples" section below are helpful. Would you let us know if this is a breaking change or just a bug that slipped in the 1.8 release?
Debugging
As described above, starting with Remix 1.8, calling
useCatch
inside the rootCatchBoundary
will not return the data thrown by the root loader when these conditions are true for a given document request:loader
and aCatchBoundary
. The loader throws a json response.CatchBoundary
. Its loader also throws a json response.In this scenario, the root
CatchBoundary
will be rendered but callinguseCatch
will return:Stepping through the Remix codebase after the latest release, we found out that:
root
route if the conditions described above are true. Essentially, this is what happens:Reproducible examples
To demonstrate the above better, I created a sample repo that contains a
main
branch that uses Remix v1.8 and displays the issue I described above. It also includes aremix_1_7_6
branch that uses Remix v1.7.6 and works as expected. The only difference between the two is the Remix version used. Please find the repo here:To make sure that we can reproduce the above outside of our local dev env, we also deployed both versions of the app on Vercel as well:
✅ https://remix-18-catchboundaries.vercel.app
✅ https://remix-18-catchboundaries.vercel.app/example-with-catchboundary
❌ https://remix-18-catchboundaries.vercel.app/example-without-catchboundary
✅ https://remix-17-catchboundaries.vercel.app/
✅ https://remix-17-catchboundaries.vercel.app/example-with-catchboundary
✅ https://remix-17-catchboundaries.vercel.app/example-without-catchboundary
If you prefer stackblitz demos, please use these instead:
Also added a bug-report-test as requested by the "Submit Issue" template in this PR: #4792
The text was updated successfully, but these errors were encountered: