Skip to content

fix: clean up injected styles to prevent background persisting after errors (#1363)#1917

Open
AbdullahShafqat-OG wants to merge 2 commits intosveltejs:mainfrom
AbdullahShafqat-OG:persistent-background-after-errors
Open

fix: clean up injected styles to prevent background persisting after errors (#1363)#1917
AbdullahShafqat-OG wants to merge 2 commits intosveltejs:mainfrom
AbdullahShafqat-OG:persistent-background-after-errors

Conversation

@AbdullahShafqat-OG
Copy link
Copy Markdown
Contributor

Fixes an issue in the Advanced Svelte tutorial where the deepsea.webp background image persists across lessons after a runtime error.

The problem occurred when a runtime error (e.g. referencing an undefined variable) interrupted normal cleanup in the REPL. :global() styles injected by the bundler were not properly removed, causing the background image to persist even after navigating to other lessons.

This has been resolved by assigning svelte- prefixed IDs to bundler-injected <style> elements. This allows them to be reliably identified and cleaned up between REPL evaluations, ensuring that stale global styles do not leak across lessons.

Fixes #1363

Before

prev

After

after

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 5, 2026

@AbdullahShafqat-OG is attempting to deploy a commit to the Svelte Team on Vercel.

A member of the Team first needs to authorize it.

@AbdullahShafqat-OG AbdullahShafqat-OG force-pushed the persistent-background-after-errors branch from a03a3f1 to ef3c643 Compare April 7, 2026 20:41
@AbdullahShafqat-OG AbdullahShafqat-OG force-pushed the persistent-background-after-errors branch from ef3c643 to 8c97a4e Compare April 15, 2026 21:07
@AbdullahShafqat-OG AbdullahShafqat-OG force-pushed the persistent-background-after-errors branch from 8c97a4e to 2505771 Compare April 30, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Advanced Svelte Tutorial: deepsea.webp image is cached

1 participant