router icon indicating copy to clipboard operation
router copied to clipboard

feat(react-router): allow `useMatch` to not throw if match was not found

Open schiller-manuel opened this issue 1 year ago • 2 comments

in this case, matchRoute will return undefined

schiller-manuel avatar Jun 12 '24 23:06 schiller-manuel

☁️ Nx Cloud Report

CI is running/has finished running commands for commit ff43790013d65d9d29584b5ad145ca66f1b21f68. 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 3 targets

Sent with 💌 from NxCloud.

nx-cloud[bot] avatar Jun 12 '24 23:06 nx-cloud[bot]

To me this makes sense, I think matchRoute is not the same because it doesn't provide the same stuff a useMatch and its definitely possible users might want to conditionally render based on a match or not.

I think we just need to think about if select should be called if the match is undefined

chorobin avatar Jun 13 '24 18:06 chorobin

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

commit: ff43790

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@1738
@tanstack/react-cross-context

npm i https://pkg.pr.new/@tanstack/react-cross-context@1738
@tanstack/react-router

npm i https://pkg.pr.new/@tanstack/react-router@1738
@tanstack/react-router-with-query

npm i https://pkg.pr.new/@tanstack/react-router-with-query@1738
@tanstack/router-cli

npm i https://pkg.pr.new/@tanstack/router-cli@1738
@tanstack/router-devtools

npm i https://pkg.pr.new/@tanstack/router-devtools@1738
@tanstack/router-generator

npm i https://pkg.pr.new/@tanstack/router-generator@1738
@tanstack/router-plugin

npm i https://pkg.pr.new/@tanstack/router-plugin@1738
@tanstack/router-vite-plugin

npm i https://pkg.pr.new/@tanstack/router-vite-plugin@1738
@tanstack/start

npm i https://pkg.pr.new/@tanstack/start@1738
@tanstack/start-vite-plugin

npm i https://pkg.pr.new/@tanstack/start-vite-plugin@1738

templates

pkg-pr-new[bot] avatar Jul 11 '24 16:07 pkg-pr-new[bot]