fix: prevent Twoslash poppers from persisting between slides
Prevent Twoslash poppers from persisting when navigating across slides by watching currentSlideRoute.
Fixes #2202
Deploy Preview for slidev ready!
| Name | Link |
|---|---|
| Latest commit | e9d87f2299e21ae19aeecd2974e8ccaea0fb0dea |
| Latest deploy log | https://app.netlify.com/projects/slidev/deploys/6923e126953ad200087d4a69 |
| Deploy Preview | https://deploy-preview-2292--slidev.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify project configuration.
@slidev/client
npm i https://pkg.pr.new/slidevjs/slidev/@slidev/client@2292
create-slidev
npm i https://pkg.pr.new/slidevjs/slidev/create-slidev@2292
create-slidev-theme
npm i https://pkg.pr.new/slidevjs/slidev/create-slidev-theme@2292
@slidev/parser
npm i https://pkg.pr.new/slidevjs/slidev/@slidev/parser@2292
@slidev/cli
npm i https://pkg.pr.new/slidevjs/slidev/@slidev/cli@2292
@slidev/types
npm i https://pkg.pr.new/slidevjs/slidev/@slidev/types@2292
commit: e9d87f2
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.
The fixed popers displayed by ^? in Twoslash doesn’t work well in Slidev. When adjacent slides are preloaded—or when all slides are preloaded after three seconds— ^? poppers appear, even on slides they don’t belong to. Moreover, once these poppers show up, navigate to other slide pages doesn’t close them unless they were manually closed.
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?
As for the issue #2202 (which could affect the presentation process), I believe the changes in useNav.ts can resolve that. But for the poppers showing during preload (which results in the slide being cluttered with popups on first load), my current thought is to close them after poping-up with a setTimeout. That said, this problem is generally less critical during a presentation compared to the one discussed in the issue #2202 , since it only happens when slides are initially loaded.
My thoughts might be a bit scattered — want to hear what the community and maintainers think.
Seems like not the cleanest solution, but I think it works beautifully now!
https://github.com/user-attachments/assets/3f99f218-e2c3-487c-92fd-c9defe2f62a7
Hi @elecmonkey and @antfu,
I've been experiencing the issue this PR fixes (#2202), and I'd love to see this merged! The Twoslash popover persisting between slides is quite noticeable during presentations.
Just wanted to check in on the status—is there anything that needs to be addressed following @antfu's feedback on the build-time flag approach? Happy to help with testing or anything else if needed.
Thanks for working on this!