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): loader promise not resolving when error thrown in params.parse #2682

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vishwamartur
Copy link

Related to #2514

Add test to verify notFoundComponent is displayed when an error is thrown in params.parse in a child route.

  • Add a new test case in errorComponent.test.tsx to check if the notFoundComponent is rendered when an error is thrown in params.parse.
  • Create a root route with a notFoundComponent.
  • Create an index route with a link to a child route.
  • Create a child route with a params.parse function that throws an error for a specific condition and an onError function that re-throws the error as notFound().
  • Render the router and simulate a click on the link to the child route.
  • Verify that the notFoundComponent is displayed.

Related to TanStack#2514

Add test to verify `notFoundComponent` is displayed when an error is thrown in `params.parse` in a child route.

* Add a new test case in `errorComponent.test.tsx` to check if the `notFoundComponent` is rendered when an error is thrown in `params.parse`.
* Create a root route with a `notFoundComponent`.
* Create an index route with a link to a child route.
* Create a child route with a `params.parse` function that throws an error for a specific condition and an `onError` function that re-throws the error as `notFound()`.
* Render the router and simulate a click on the link to the child route.
* Verify that the `notFoundComponent` is displayed.
Copy link

nx-cloud bot commented Oct 31, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 4050e58. 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


🟥 Failed Commands
nx affected --targets=test:eslint,test:unit,test:e2e,test:types,test:build,build --parallel=3
✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@schiller-manuel
Copy link
Contributor

is this testing the same thing as #2636 ?

Copy link

pkg-pr-new bot commented Oct 31, 2024

Open in Stackblitz

More templates

@tanstack/create-router

pnpm add https://pkg.pr.new/@tanstack/create-router@2682

@tanstack/eslint-plugin-router

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

@tanstack/react-cross-context

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

@tanstack/react-router

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

@tanstack/history

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

@tanstack/react-router-with-query

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

@tanstack/router-arktype-adapter

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

@tanstack/router-cli

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

@tanstack/router-devtools

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-valibot-adapter

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

@tanstack/router-vite-plugin

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

@tanstack/router-zod-adapter

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

@tanstack/start

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

@tanstack/start-vite-plugin

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

@tanstack/virtual-file-routes

pnpm add https://pkg.pr.new/@tanstack/virtual-file-routes@2682

commit: 4050e58

@SeanCassiere SeanCassiere changed the title Fix loader promise not resolving when error thrown in params.parse fix(react-router): loader promise not resolving when error thrown in params.parse Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants