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

CSS injected by UnoCSS incomplete on first load #1705

Open
jgosmann opened this issue Jun 26, 2024 · 2 comments
Open

CSS injected by UnoCSS incomplete on first load #1705

jgosmann opened this issue Jun 26, 2024 · 2 comments
Labels
bug:upstream bug Something isn't working help wanted Extra attention is needed needs investigation

Comments

@jgosmann
Copy link
Contributor

jgosmann commented Jun 26, 2024

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.
480p.mov

Environment

  • Slidev version: v0.49.12
  • Browser: Firefox 127.0.2, Chrome 126.0.6478.116
  • OS: macOS 14.5
@jgosmann
Copy link
Contributor Author

jgosmann commented Jun 26, 2024

There might be an interaction with the theme (that I unfortunately cannot share). The theme used defines its own uno.config.ts and sets shortcuts and custom theme colors in there. With the seriph theme I couldn't reproduce it so far. But then again, I'm now failing again to reproduce it with the same theme that was showing the issue earlier. 😞

Edit: It is not dependent on the theme. I could just reproduce it with the seriph theme. Factors that seem to make the issue more likely:

  • Having opened the presentation an a background browser tab, then restarting the presentation and opening it in a new tab.
  • Fetching __uno.css in a terminal before opening the presentation. (This hints at the relative timing of requests potentially being important. At least it would explain why the bug isn't completely deterministic to reproduce.)

Unfortunately, I still couldn't figure out an absolutely reliable way to trigger the bug. In particular, I couldn't get it to show with a freshly initialized presentation.

@KermanX KermanX added bug Something isn't working help wanted Extra attention is needed needs investigation bug:upstream labels Jun 27, 2024
@KermanX
Copy link
Member

KermanX commented Jun 27, 2024

Similar to #1573 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:upstream bug Something isn't working help wanted Extra attention is needed needs investigation
Projects
None yet
Development

No branches or pull requests

2 participants