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

Don't prefetch again for same transition & params #8

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

Conversation

nickiaconis
Copy link
Owner

Prevents a route's prefetch hook from being invoked multiple times for the same transition/parameters when a redirect occurs.

  • Needs testing to prevent regression.

@@ -39,6 +41,14 @@ export function initialize(instance) {
fullParams.queryParams = transition.queryParams;
}

// Skip handlers that have already run with the same params.
if (JSON.stringify(routeParamsMap[handlerInfo.name]) === JSON.stringify(fullParams)) {
Copy link
Owner Author

Choose a reason for hiding this comment

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

This should use json-stable-stringify.

@nathanhammond
Copy link
Collaborator

Can you try to use paramsFor?

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.

None yet

2 participants