-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: optimize get fragment visit #79
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…sit` is being called as an API function
An alternative could be to check if all containers for the current visit already match the |
Closing this as I'd like to go through all this in an issue first. |
4 tasks
daun
approved these changes
Jun 4, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
I just stumbled upon a case where the sole fragment that was being targeted for the current visit already had the same fragment url as
visit.to.url
, causing a normal (non-fragment) visit that broke as of course thecontainers
were missing (hard to explain 😅).Allowing visits that don't replace anything was exactly what I needed in this case.Actually, the comment I posted below lead me to the real solution: Treat a visit as a reload, if all fragment elements already match that visit's
visit.to.url
. In other words: Don't skip fragments as described in https://swup.js.org/plugins/fragment-plugin/#how-fragment-containers-are-found, bullet 3, if otherwise no fragments would be replaced at all.Drive-By
visit
introduced forrule.if
had the wrong route if being called as an API function. It will now be created on the fly usingswup.createVisit(route)
.Checks
master
branchnpm run lint
)npm run test
)The documentation was updated as requiredAdditional information