Skip to content

fix(router-core): handle AbortError in router execution flow #4570

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

leesb971204
Copy link
Contributor

fixes #4517

Signed-off-by: leesb971204 <leesb971204@gmail.com>
Copy link

nx-cloud bot commented Jul 3, 2025

View your CI Pipeline Execution ↗ for commit e2a8074

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

☁️ Nx Cloud last updated this comment at 2025-07-04 07:40:27 UTC

Copy link

pkg-pr-new bot commented Jul 3, 2025

More templates

@tanstack/arktype-adapter

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

@tanstack/directive-functions-plugin

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

@tanstack/eslint-plugin-router

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

@tanstack/history

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-with-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-plugin

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/server-functions-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-plugin

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-server-functions-client

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

@tanstack/start-server-functions-fetcher

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

@tanstack/start-server-functions-server

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/zod-adapter

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

commit: e2a8074

Comment on lines +2514 to +2529
if (
e instanceof DOMException &&
e.name === 'AbortError'
) {
const head = await executeHead()
updateMatch(matchId, (prev) => ({
...prev,
status:
prev.status === 'pending'
? 'success'
: prev.status,
...head,
}))
return
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the documentation, the abortController.abort() method throws an Error object of type DOMException with the name AbortError.
When this error is thrown during route loading, it is treated as a normal control flow and the route is updated to a valid state accordingly.

Copy link
Contributor Author

@leesb971204 leesb971204 Jul 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SeanCassiere

I noticed you’ve explored similar concerns before(#4531), so I think it would be great to discuss this approach together.

…asepath

Signed-off-by: leesb971204 <leesb971204@gmail.com>
@leesb971204
Copy link
Contributor Author

@SeanCassiere

Would there be a chance for us to have a conversation about this?

Copy link
Member

@SeanCassiere SeanCassiere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that!

@schiller-manuel there were recent changes this flow if I'm not mistaken with the selective SSR stuff. Would this be an issue?

@leesb971204 provided Manuel's fine with these changes, I don't see a reason not to get this pushed in.

Edit: Also, please make sure that your test are reflected in @tanstack/solid-router as well.

…asepath

Signed-off-by: leesb971204 <leesb971204@gmail.com>
@leesb971204
Copy link
Contributor Author

Sorry about that!

@schiller-manuel there were recent changes this flow if I'm not mistaken with the selective SSR stuff. Would this be an issue?

@leesb971204 provided Manuel's fine with these changes, I don't see a reason not to get this pushed in.

Edit: Also, please make sure that your test are reflected in @tanstack/solid-router as well.

Thanks for the comment!
I’ve added the same test to solid-router as well.

@leesb971204
Copy link
Contributor Author

Sorry about that!

@schiller-manuel there were recent changes this flow if I'm not mistaken with the selective SSR stuff. Would this be an issue?

@leesb971204 provided Manuel's fine with these changes, I don't see a reason not to get this pushed in.

Edit: Also, please make sure that your test are reflected in @tanstack/solid-router as well.

Are there any other tasks that need to be completed before this work can be approved?

@SeanCassiere
Copy link
Member

Are there any other tasks that need to be completed before this work can be approved?

Other than the current merge conflict, as mentioned here, I'd like @schiller-manuel to take a look at how this is being handled.

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.

AbortError: signal is aborted without reason is bubbling up when using loader with basepath
2 participants