Repository navigation
fix(auth): start a browser with no saved theme on dark on sign-in and the password pages too - #2453
Merged
Merged
Conversation
… the password pages too PostHog showed a first-time visitor who lands on sign-in seeing the light theme: only sign-up and onboarding rendered NewUserTheme. Sign-in, forgot password and reset password now render it too, at the top of the page as sign-up does. On Ansvisor Cloud, a browser with no saved theme starts on dark there and keeps it; a browser with a saved theme never changes; self-hosted is unchanged. Sign-in can't tell new people from returning ones, so someone on a new browser or device, or one where they never picked a theme, also starts dark (accepted by the owner). The consent page is left as it is: a signed-out person is sent to sign-in first. - auth-pages.test.tsx: the four pages carry the script first on Cloud and nothing self-hosted; the consent page carries none. - Comments in new-user-theme.tsx and config/theme.ts say where it runs. - Help light-and-dark-mode and its FAQ source updated; approved-articles regenerated. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
gkhngyk
pushed a commit
that referenced
this pull request
Nov 16, 2026
Follow-up to #2453, the owner's option B. Since #2280 and #2453, on Ansvisor Cloud the sign-up, sign-in, password and onboarding pages save dark in a browser with no saved theme. Someone who already used Ansvisor and never pressed the sun/moon button has no saved theme either, so they would switch to dark the next time they saw sign-in signed out. KeepCurrentTheme, rendered once in the dashboard layout, saves light in a browser with no saved theme when a signed-in person opens a dashboard page, on Cloud only. Light is the ThemeProvider's default, so nothing changes on screen. A saved theme is never changed, and a new person already has dark saved before they reach the dashboard. Self-hosted is unchanged. - config/theme.ts: EXISTING_USER_THEME ('light'), with the owner's choice and how to remove it; the comments on who starts dark updated, in new-user-theme.tsx too. - keep-current-theme.test.tsx: saves light only when nothing is saved, never overrides dark or light, nothing self-hosted, survives a throwing localStorage, draws nothing. - Dashboard layout tests: light saved on Cloud with nothing saved; a saved theme kept; nothing saved on the way to onboarding or self-hosted. - Help light-and-dark-mode and its FAQ source: people who already use Ansvisor keep their mode, new people start on dark; approved-articles regenerated. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
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.
Summary
The owner saw in PostHog that a first-time visitor who lands on sign-in sees the light theme. Since #2280, only sign-up and onboarding start a new browser on dark, and many first visits land on sign-in.
Accepted trade-off: the theme is saved per browser, not per account. On sign-in we can't tell new people from returning ones, so a returning person on a new browser or device also starts on dark. So does a returning person who never picked a theme in this browser, the next time they see the sign-in page. The sun/moon button beside the logo switches back, and that choice is kept.
Changes
<NewUserTheme />at the top, with a short comment, the same way sign-up does. Sign-in keeps its structure: the async server page still wrapsSignInView, andNewUserThemesits inside the view.oauth/consentuses the same auth frame, but a signed-out person is sent to sign-in first, and sign-in now starts them on dark. Adding it would reach no new visitor. It would only switch people who are already signed in.new-user-theme.tsxandconfig/theme.tsnow say which pages run it, and what sign-in can't tell apart.auth-pages.test.tsxchecks that on Cloud, sign-up, sign-in, forgot password and reset password carry the script once, before the page. Self-hosted, they carry nothing. The consent page carries nothing.approved-articles.jsonis regenerated. The FAQ entry the article comes from says the same.en.jsonchange, no migration, no new dependency.Who sees what
Decision for the owner
next-themes saves a theme only when someone presses the sun/moon button. So an existing user who never pressed it has no saved theme, even on the browser they always use. With this change, the next time they reach sign-in signed out (after signing out, or when their session ends), they switch to dark.
lightis saved, the look they already have. After this ships, existing users keep light. New people still start on dark, because sign-up, sign-in and onboarding savedarkfirst. Only an existing user whose first visit after the release is the sign-in page would still start on dark.How to test
NEXT_PUBLIC_IS_CLOUD=true), open a fresh private window and go to/sign-in. It opens dark./sign-in. It stays light./forgot-passwordand/reset-password. Both open dark.NEXT_PUBLIC_IS_CLOUD=false), a fresh private window on/sign-instays light.Checks
tsc --noEmit: clean.src/components/auth,src/components/theme, the(marketing)and(onboarding)page tests,src/lib/help,src/i18n,use-server-exports,theme-toggle.auth-pages.test.tsx(4 pages on Cloud, 4 pages self-hosted, the consent page). The sign-in test fails without the change.next dev, Cloud on, fresh headless Chrome profile): sign-in, forgot password, reset password and sign-up each opened withdarkon the page andtheme=darksaved. After light was saved, sign-in stayed light.Generated by Claude Code