Skip to content

Conversation

nlynzaad
Copy link
Contributor

@nlynzaad nlynzaad commented Jul 6, 2025

This PR is a follow-up to #4573.

When checking if the paths have changed, we need to also take into account any trailing slashes. This resolves #4580.

when comparing the paths in this issue the resolved path for dest.to did not have a trailing slash while the fromPath did.

Setting up test for similar routing structures did not lead to the same failures so I'm not too sure how to recreate this with a test, to be honest not sure what would be the required actions to cause the from path to contain a trailing slash.

Tested this by patching the modules in the example and it succeeded then.

Copy link

nx-cloud bot commented Jul 6, 2025

View your CI Pipeline Execution ↗ for commit 952f5e8

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ❌ Failed 5m 13s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 2m 6s View ↗

☁️ Nx Cloud last updated this comment at 2025-07-06 15:55:03 UTC

Copy link

pkg-pr-new bot commented Jul 6, 2025

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@4581

@tanstack/directive-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@4581

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@4581

@tanstack/history

npm i https://pkg.pr.new/TanStack/router/@tanstack/history@4581

@tanstack/react-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@4581

@tanstack/react-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@4581

@tanstack/react-router-with-query

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

@tanstack/react-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@4581

@tanstack/react-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@4581

@tanstack/react-start-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-plugin@4581

@tanstack/react-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@4581

@tanstack/router-cli

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@4581

@tanstack/router-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@4581

@tanstack/router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@4581

@tanstack/router-devtools-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@4581

@tanstack/router-generator

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@4581

@tanstack/router-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@4581

@tanstack/router-utils

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@4581

@tanstack/router-vite-plugin

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

@tanstack/server-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@4581

@tanstack/solid-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@4581

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@4581

@tanstack/solid-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@4581

@tanstack/solid-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@4581

@tanstack/solid-start-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-plugin@4581

@tanstack/solid-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@4581

@tanstack/start-client-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@4581

@tanstack/start-plugin-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@4581

@tanstack/start-server-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@4581

@tanstack/start-server-functions-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-functions-client@4581

@tanstack/start-server-functions-fetcher

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-functions-fetcher@4581

@tanstack/start-server-functions-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-functions-server@4581

@tanstack/valibot-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@4581

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@4581

@tanstack/zod-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@4581

commit: 952f5e8

@nlynzaad
Copy link
Contributor Author

nlynzaad commented Jul 6, 2025

ran all tests locally multiple times, by resetting the local nx cache and workspaceData, and I'm not able to reproduce the failure reported here.

@nlynzaad nlynzaad changed the title fix: buildLocation check for non changing routes - allow trailing slahes fix: buildLocation check for non changing routes - consider trailing slashes Jul 6, 2025
@schiller-manuel
Copy link
Contributor

that's a flaky test in ci

@nlynzaad
Copy link
Contributor Author

nlynzaad commented Jul 6, 2025

when running the test in isolation I was able to get the error.

I added a check for the "Client only Content" before navigation to ensure it has rendered prior to navigation. This seems to have resolved the error. Also updated it to find by testId and added mock for scrollTo.

Hoping this resolves the issue in the CI

@schiller-manuel
Copy link
Contributor

very cool.

coming back to the original issue, can we not build a unit test that resembles the reproducer?

@nlynzaad
Copy link
Contributor Author

nlynzaad commented Jul 6, 2025

I'll spend some time to try and recreate it now.

Going to be a bit trial and error since I'm not too sure what navigation action caused a trailing slash on the fromPath that broke it. But once I have figured that out, I can add the test

@nlynzaad
Copy link
Contributor Author

nlynzaad commented Jul 6, 2025

test added. ended up just being the route path that had to be set accordingly

@schiller-manuel schiller-manuel merged commit 9603235 into TanStack:main Jul 6, 2025
4 of 5 checks passed
@nlynzaad nlynzaad deleted the Fix-4580 branch July 6, 2025 16:25
@checkerschaf
Copy link

It works with the latest release 🥳 Thanks @nlynzaad & @schiller-manuel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

router: buildLocation non-changing route with index route

3 participants