Skip to content
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

fix(react-router): reset error boundary after the new matches are ready #2244

Merged
merged 2 commits into from
Sep 2, 2024

Conversation

cristi-lng
Copy link
Contributor

@cristi-lng cristi-lng commented Sep 1, 2024

In the current version of the router, the error boundary is reset at the beginning of the loading phase of the new matching routes. This is a problem because the currently rendered routes can re-render while the new ones ar being in the loading process. If this is the case, the re-render will trigger the error boundary again and will void the reset.

I believe the reset should happen only after the new routes have finished loading. In this way, the reset will be in sync with the matched routes.

I don't know if this fix might have some side effects, but on our project it seems to work. If you think that this fix is not ok or you have a better solution, I would be happy to try it out.

Here is the issue I am referring to: #2162

fixes #2162
fixes #2043

Copy link

nx-cloud bot commented Sep 2, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 6591ebb. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 2 targets

Sent with 💌 from NxCloud.

Copy link

pkg-pr-new bot commented Sep 2, 2024

Open in Stackblitz

More templates

@tanstack/history

pnpm add https://pkg.pr.new/@tanstack/history@2244

@tanstack/react-cross-context

pnpm add https://pkg.pr.new/@tanstack/react-cross-context@2244

@tanstack/react-router

pnpm add https://pkg.pr.new/@tanstack/react-router@2244

@tanstack/react-router-with-query

pnpm add https://pkg.pr.new/@tanstack/react-router-with-query@2244

@tanstack/router-arktype-adapter

pnpm add https://pkg.pr.new/@tanstack/router-arktype-adapter@2244

@tanstack/router-cli

pnpm add https://pkg.pr.new/@tanstack/router-cli@2244

@tanstack/router-generator

pnpm add https://pkg.pr.new/@tanstack/router-generator@2244

@tanstack/router-devtools

pnpm add https://pkg.pr.new/@tanstack/router-devtools@2244

@tanstack/router-valibot-adapter

pnpm add https://pkg.pr.new/@tanstack/router-valibot-adapter@2244

@tanstack/router-plugin

pnpm add https://pkg.pr.new/@tanstack/router-plugin@2244

@tanstack/router-vite-plugin

pnpm add https://pkg.pr.new/@tanstack/router-vite-plugin@2244

@tanstack/router-zod-adapter

pnpm add https://pkg.pr.new/@tanstack/router-zod-adapter@2244

@tanstack/start

pnpm add https://pkg.pr.new/@tanstack/start@2244

@tanstack/start-vite-plugin

pnpm add https://pkg.pr.new/@tanstack/start-vite-plugin@2244

commit: 6591ebb

@schiller-manuel schiller-manuel changed the title fix(react-router)(issue-2162): reset error boundary after the new matches are ready fix(react-router): reset error boundary after the new matches are ready Sep 2, 2024
@schiller-manuel schiller-manuel merged commit 17d9885 into TanStack:main Sep 2, 2024
5 checks passed
@schiller-manuel
Copy link
Contributor

thanks a lot for your contribution!

@cristi-lng
Copy link
Contributor Author

Thanks for the merge. I was quite busy today and didn't manage to create a unit test. Sorry about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants