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(nuxt): add experimental View Transitions API support #20092
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
Β Open in CodeSandbox Web Editor | VS Code | VS Code Insiders |
β Live Preview ready!
|
Merged
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.
β Type of change
π Description
This adds an experimental View Transitions API integration for Nuxt.
You can play around with the implementation in this sandbox or read more about the API.
βΉ Tips
If you are using Vue transitions to achieve the same result as View Transitions (yes, this is incredibly confusing), then you may wish to disable Vue transitions if the user's browser supports native View Transitions. You can do this by creating
~/middleware/disable-vue-transitions.global.ts
with the following contents:π¨ Known issues
<Suspense>
resolves, but in the interim you may want to consider carefully whether to adopt this feature if this describes you.β TODO
I would very much welcome thoughts and improvements even at this stage, but expect that there's some considerable improvement to be made here. In particular, some avenues to explore:
See if it's possible to call the route change withinWe can listen to vue errors and throw the promise passed tostartViewTransition
, so any errors can be caught there. (This results in a cleaner error handling story and is a nice-to-have but not essential objective.)startViewTransition
.Consider whether to disable native Vue page transitions by default when this feature is enabled (settingAdded instructions for how to do this manually, which feels like a better choice.app.pageTransition
to false).<Suspense>
resolves. The transition completely freezes DOM updates. We therefore don't want it pending while data fetching takes place, so ideally we only want to initiate the transition before the DOM is updated.π Checklist