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

Searchbox blinking on firtst usage #2513

Closed
4 tasks done
elringus opened this issue Jun 16, 2023 · 4 comments · Fixed by #2519
Closed
4 tasks done

Searchbox blinking on firtst usage #2513

elringus opened this issue Jun 16, 2023 · 4 comments · Fixed by #2519
Labels
theme Related to the theme

Comments

@elringus
Copy link

Describe the bug

When clicking the searchbox (or pressing ctrl+k) for the first time after the page loaded, it disappears for about 500ms.

vid.mp4

Reproduction

  1. Open https://vitepress.dev
  2. Click the searchbox or press ctrl+k
  3. Notice the box is hidden for about 500ms before the search overlay is loaded

Expected behavior

The searchbox doesn't disappear.

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (16) x64 Intel(R) Core(TM) i7-6900K CPU @ 3.20GHz
    Memory: 49.17 GB / 63.92 GB
  Binaries:
    Node: 18.2.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 9.6.6 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 114.0.5735.134
    Edge: Spartan (44.19041.1266.0), Chromium (114.0.1823.43)

Additional context

No response

Validations

@elringus elringus added the bug: pending triage Maybe a bug, waiting for confirmation label Jun 16, 2023
@brc-dd brc-dd removed the bug: pending triage Maybe a bug, waiting for confirmation label Jun 17, 2023
@elringus
Copy link
Author

elringus commented Jun 18, 2023

@brc-dd Hey, Do I get it right that you don't qualify this as a bug? If not, why? In case you wasn't able to reproduce it, make sure to clear browser cache and force-reload the page (ctrl+f5).

img

@brc-dd
Copy link
Member

brc-dd commented Jun 18, 2023

It is sort of expected behavior because that Algolia chunk is loaded dynamically on demand to reduce the initial load times. That element is then swapped by the docsearch one. That swap is appearing as the blink to you. But the blink is usually in sub seconds, and is very fast (<10ms) once that chunk is cached by the browser. We can try to figure out some way to avoid the element removal till the new one is mounted, but that might be bit of overengineering.

@brc-dd brc-dd added the theme Related to the theme label Jun 18, 2023
@elringus
Copy link
Author

elringus commented Jun 18, 2023

Well, that doesn't happen on other sites, that use algolia, so it should be something vite or vitepress-specific. Users of my docs clearly identify this as a bug/glitch and I agree with them. Is there a way to make vite/vitepress preload the chunk, so that at least it doesn't disappear for that long on the initial load?

@elringus
Copy link
Author

Thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
theme Related to the theme
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants