slidevjs/slidev

CSS injected by UnoCSS incomplete on first load

開放

#1,705 建立於 2024年6月26日

 (2 則留言) (0 個反應) (0 位負責人)TypeScript (2,067 個分叉)batch import
help wantedneeds investigationupstream🔨 p3-minor-bug

倉庫指標

星標
 (46,472 顆星)
PR 合併指標
 (平均合併 10天 22小時) (30 天內合併 9 個 PR)

描述

Describe the bug

Often (but not always, I wasn't able to reliably reproduce the issue), the CSS injected by UnoCSS is incomplete and slides appear broken. It seems that this happens when another tab that has loaded the presentation has already been open in the background in the browser when Slidev is started and the presentation is loaded in a new tab. Most commonly the nav controls are shown incorrectly. After the first load, requesting the __uno.css will return all required styles and thus, a reload fixes the issue.

Minimal reproduction

Unfortunately, I cannot provide a reliable minimal reproduction yet. But maybe the video recording below helps. This is what happens in there:

  1. I have started the Slidev presentation, but not loaded it in the browser.
  2. I fetch __uno.css in the terminal. Observe that the CSS content isn't very long.
  3. I load the presentation in the browser. The nav controls are not displayed correctly because some of the CSS styles are missing.
  4. I fetch __uno.css once more in the terminal. Observe that the CSS content is now considerably longer. Diffing the previous content with the content now also reveals major differences.
  5. I reload the slides in the browser. Now everything is displayed correctly.

https://github.com/slidevjs/slidev/assets/850157/714268bb-8c9c-47e0-870a-097c7386aa50

Environment

  • Slidev version: v0.49.12
  • Browser: Firefox 127.0.2, Chrome 126.0.6478.116
  • OS: macOS 14.5

貢獻者指南