Skip to content

fix(theme): keep people who already use Ansvisor on light - #2457

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:fix/keep-existing-users-light
Nov 16, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:fix/keep-existing-users-light

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Please release this together with #2453. Without it, #2453 switches most existing users to dark the next time they see sign-in. The owner chose this option (B) on 16 Nov.

Summary

Follow-up to #2453. This is 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. Most people who already use Ansvisor never pressed the sun/moon button, so they have no saved theme either. They would switch to dark the next time they saw sign-in signed out.

With this change, a signed-in person who opens any dashboard page in a browser with no saved theme gets light saved. Light is what they already see, so nothing changes on screen. New people are not affected: dark was saved on sign-up, sign-in or onboarding before they reach the dashboard. Self-hosted is unchanged.

Changes

  • web/src/components/theme/keep-current-theme.tsx (new): a small client component. On Cloud, in an effect, it saves light when nothing is saved. It never changes a saved theme. It does nothing if localStorage throws. It draws nothing.
  • web/src/app/[locale]/(dashboard)/layout.tsx: renders it once, next to BrandLoader.
  • web/src/config/theme.ts: new EXISTING_USER_THEME = 'light', with the owner's choice and how to remove it. Set it to null to stop, or remove the component and the constant. The NEW_USER_THEME comment now says who starts dark.
  • web/src/components/theme/new-user-theme.tsx: comment updated.
  • Help light-and-dark-mode and docs/faq.mdx: people who already use Ansvisor keep their mode, new people start on dark, a new browser or device starts on dark at sign-in. approved-articles.json regenerated.
  • Tests: keep-current-theme.test.tsx (new) and 5 new cases in the dashboard layout tests.

Who sees what

Who Browser Before this change After this change
New person (Cloud) Any Dark from sign-up or sign-in Dark from sign-up or sign-in (unchanged)
Existing user, never picked a theme (Cloud) Opens the dashboard signed in Light now, dark after the next sign-in Light is saved and kept
Existing user, never picked a theme (Cloud) Session ended before they open the dashboard again Dark at sign-in Dark at sign-in (this change can't reach them)
Anyone who picked a theme Any Their theme Their theme (unchanged)
Anyone (Cloud) New browser or device Dark at sign-in Dark at sign-in (unchanged)
Self-hosted Any Light Light (unchanged)

How to test

  1. On Cloud (NEXT_PUBLIC_IS_CLOUD=true), sign in, then in DevTools remove the theme key from localStorage.
  2. Reload a dashboard page. It stays light, and theme is now light.
  3. Sign out. Sign-in opens in light, not dark.
  4. Set theme to dark and open a dashboard page. It stays dark.
  5. In a fresh private window, sign up. Sign-up and onboarding are dark, and the dashboard stays dark.
  6. Self-hosted: remove theme and open a dashboard page. Nothing is saved.

Checks

  • npx tsc --noEmit -p .: clean.
  • Vitest: 9 files, 75 tests pass (src/components/theme, the dashboard layout, the (marketing) auth pages, src/lib/help, src/i18n, use-server-exports). The (onboarding) tests pass too (3 files, 37 tests).
  • ESLint (--max-warnings=0) and Prettier clean on the changed code files.
  • git merge-tree with main at 299a19e95: clean.
  • No migration, no new dependency, no lockfile change. No 'use server' file touched.

Generated by Claude Code

Follow-up to ansvisor#2453, the owner's option B. Since ansvisor#2280 and ansvisor#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
@mintlify

mintlify Bot commented Nov 16, 2026

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 27f7529.

Approve preview

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

@gkhngyk
gkhngyk merged commit 9abf638 into ansvisor:main Nov 16, 2026
12 checks passed
cihan-gyk pushed a commit to cihan-gyk/ansvisor that referenced this pull request Nov 16, 2026
Brings in ansvisor#2449, ansvisor#2450, ansvisor#2457, ansvisor#2460 and ansvisor#2461 (Chat and MCP lookups by
code, id, words, domain or address; never give up on data it could read).

Conflicts, resolved as the union of both sides:
- agent-eval.ts: the scenario keeps askedSignals/askedDomains and checks;
  QUESTION_SCENARIOS holds action-by-code, signal-by-code,
  citation-by-domain and the three ai-revenue questions; every run gets
  "never gives up on data it could read" and then its scenario's checks.
- agent-eval-data.ts: EvalWorkspace is default, action_backlog,
  long_lists and conversions_off; both sides' imports.
- agent-eval.test.ts: both sides' imports.
- brand-scope.test.ts: the AI-revenue reads and the lookups.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
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.

3 participants