fix: eliminate banner flash on page reload#663
Open
RisingOrange wants to merge 6 commits intoPauseAI:mainfrom
Open
fix: eliminate banner flash on page reload#663RisingOrange wants to merge 6 commits intoPauseAI:mainfrom
RisingOrange wants to merge 6 commits intoPauseAI:mainfrom
Conversation
…rst paint Add an inline blocking script in app.html that reads localStorage before first paint and injects display:none CSS for any dismissed banners. Add data-banner-id and data-campaign-banner-id attributes to banner elements for CSS targeting. Move Banner.svelte's hidden state check from onMount to initialization time. Remove debug console.logs and buggy global DOM click listener from Banner.svelte. Remove stale india-summit-2026 localStorage setter from layout.svelte.
👷 Deploy request for pauseai pending review.Visit the deploys page to approve it
|
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #665
Problem
When a dismissed banner is reloaded, it briefly flashes visible before disappearing. This happens because the server renders the banner as visible, the browser paints it, and only then does JS hydrate and hide it based on localStorage.
2026-02-21.20-53-24.mp4
Solution
Same technique as the existing dark mode no-flash init: add an inline blocking
<script>inapp.htmlthat runs synchronously before first paint, reads localStorage, and injects CSS to hide dismissed banners immediately.data-banner-idanddata-campaign-banner-idattributes to banner elements so the CSS can target themBanner.sveltehidden state fromonMountto initialization time (eliminates the flash window between hydration and mount)localStoragereads with try-catch to handle storage-restricted contexts (Firefox strict mode, Safari ITP, etc.)console.logs and buggy global DOM click listener fromBanner.svelteindia-summit-2026localStorage setter from+layout.svelte(banner no longer exists;CampaignBanneralready self-hides on its own page)Test plan
<head>should contain a<style>tag withdisplay:none!importantrules when localStorage has dismissed banners