-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix: prevent Twoslash poppers from persisting between slides #2292
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
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for slidev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
@slidev/client
create-slidev
create-slidev-theme
@slidev/parser
@slidev/cli
@slidev/types
commit: |
The changes make a test fail. I think I should not fix this issue by using v-if, as it will destroy the components when navigation happens. |
aae15c7
to
f6bd3e8
Compare
The fixed popers displayed by However, It isn't worthwhile to disrupt the current rendering or preload flow just to fix this. Is there a better solution under these constraints? My thoughts might be a bit scattered — want to hear what the community and maintainers think. |
preloadRoute(nextRoute.value) | ||
setTimeout(() => { | ||
hideAllPoppers() | ||
}, 150) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This timeout time is too arbitrary. Could we find a better way to do that instead of relying on timeout?\
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It stems from FloatingVue's behavior. when v-popper directives are rendered to the DOM, FloatingVue immediately creates popper instances and shows them based on the :shown='true'
... so I think maybe we could implement a custom Shiki transformer to intercept the Twoslash rendering process, and try to transform the code
f6bd3e8
to
e381c42
Compare
Seems like not the cleanest solution, but I think it works beautifully now! record.mov |
Prevent Twoslash poppers from persisting when navigating across slides by watching
currentSlideRoute
.Fixes #2202