Skip to content

Conversation

@terrerox
Copy link
Contributor

@terrerox terrerox commented Sep 30, 2025

Description

The theme was being applied after React mounted, causing a visual flash. This fix adds an inline script in index.html that applies the dark mode class synchronously during page load, before React initialization. Also persists the isDark state properly using JSON.parse() instead of string comparison.

Related Issues

Related Pull Requests

Checklist

  • Changes have been tested locally.
  • Unit tests have been written or updated as necessary.
  • The code adheres to the repository's coding standards.
  • Relevant documentation has been added or updated.
  • No new warnings or errors have been introduced.
  • SonarCloud issues have been reviewed and addressed.
  • QA Passed

Testing Process

Additional Notes

…diately

The theme was being applied after React mounted, causing a visual flash. This fix adds an inline script in index.html that applies the dark mode class synchronously during page load, before React initialization. Also persists the isDark state properly using JSON.parse() instead of string comparison.
@terrerox terrerox requested a review from CandelR as a code owner September 30, 2025 20:19
@vercel
Copy link

vercel bot commented Sep 30, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
drive-web Ready Ready Preview Comment Oct 14, 2025 5:22pm

@terrerox terrerox self-assigned this Sep 30, 2025
@terrerox terrerox marked this pull request as draft September 30, 2025 20:20
@terrerox terrerox changed the title fix: white screen blink on page load by applying dark mode theme imme… [PB-4905]: Fix white screen blink on page load Sep 30, 2025
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Sep 30, 2025

Deploying drive-web with  Cloudflare Pages  Cloudflare Pages

Latest commit: c93569a
Status: ✅  Deploy successful!
Preview URL: https://620cd351.drive-web.pages.dev
Branch Preview URL: https://fix-white-screen-blink.drive-web.pages.dev

View logs

@terrerox terrerox marked this pull request as ready for review September 30, 2025 20:25

const toggleTheme = (theme: Theme) => setCurrentTheme(theme);

const persistIsDark = (value: boolean) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the name persistIsDark is a bit confusing; you need to know what isDark is. persistDarkTheme makes it clearer what it does: persist the dark theme.

@sonarqubecloud
Copy link

@terrerox terrerox merged commit e10bc39 into master Oct 14, 2025
16 checks passed
@terrerox terrerox deleted the fix/white-screen-blink branch October 14, 2025 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants