Replies: 1 comment 2 replies
-
I think was fixed in #864, we should have a release out tomorrow, give it a shot then and I think it'll work as expected :) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been following the Remix Jokes App tutorial and I'm stuck with some very strange behaviour. I've been tinkering around with this, stripped the code of all the unnecessary side noise, gone through a lot of unexplainable moments of "Why does it work now? I didn't change anything 😫" and this is what I've come to.
So my routing structure looks like this:
In
$jokeId.tsx
, there is aloader
and anaction
function, as well as anErrorBoundary
and aCatchBoundary
. Now, my understanding from the docs and the tutorial is that when youthrow
aResponse
object in eitherloader
oraction
, it gets caught in theCatchBoundary
so you can display an error message in place. This works properly when theResponse
is thrown fromloader
, not however, when it's thrown fromaction
. When I try that, I get an error fromjokes.tsx
(the parent route of$jokeId.tsx
):The content of this error isn't really important - what it means is that a
Response
thrown from theaction
function of a child route ($jokeId.tsx
) seems to trigger a re-render in the parent (jokes.tsx
) - which I assumed wasn't the case - and that during that re-render, theloader
function isn't run and thus, the route-component doesn't have data to properly render.I assume this is a bug, because I've found an odd way to make it work: Adding a
CatchBoundary
tojokes.tsx
(the parent route) makes the problem go away. It doesn't matter what the newCatchBoundary
(injokes.tsx
) does, it's never executed, because now the otherCatchBoundary
(in$jokeId.tsx
) is executed and the error message is displayed where I want it.I can add a codesandbox if you're having a hard time understanding the problem, but it's a bit complicated to set it up with prisma and everything :D (the CSB)
Best regards
Beta Was this translation helpful? Give feedback.
All reactions