Skip to content

chore(lint): consolidate /settings localStorage reads (21 → 19 errors)#186

Merged
operatoruplift merged 1 commit intomasterfrom
lint-settings-effects
Apr 28, 2026
Merged

chore(lint): consolidate /settings localStorage reads (21 → 19 errors)#186
operatoruplift merged 1 commit intomasterfrom
lint-settings-effects

Conversation

@operatoruplift
Copy link
Copy Markdown
Owner

/settings page mount effect refactor

The /settings page had a 17-line useEffect that read localStorage at mount and called 7 separate setStates. Replaced with a single useMemo lazy-load + lazy-initializer useStates that pull from it.

Change File:line
7-setState mount effect → useMemo + lazy initializers settings/page.tsx:38-56
'Commander' default display name → 'Friend' settings/page.tsx:23
AdvancedSettings setAdvancedMode in effect → lazy initializer settings/page.tsx:412-417

Theme side effect

The theme application (document.documentElement.setAttribute('data-theme', 'light')) stays in useEffect because it's a real DOM side effect, but it now only reacts to theme state changes — no synchronous setState in the effect body.

Honesty bonus

The 'Commander' default display name (last sci-fi cosplay residual, after #163 retired it from the dashboard h1 and #168 retired it from /api/auth/signup) became 'Friend'. This was the last hit anywhere in the codebase.

Verified

pnpm exec tsc --noEmit
# exit 0

pnpm check
# 3 passed, 0 failed

pnpm lint
# 85 problems (19 errors, 66 warnings)   <- was 87 / 21

Net diff

1 file changed, 50 insertions(+), 40 deletions(-)

Rollback

Single git revert.

The /settings page had a 17-line useEffect that read localStorage at
mount and called 7 separate setStates. Replaced with a single useMemo
lazy load + lazy-initializer useStates that pull from it.

The theme effect stays as a real DOM side effect (sets data-theme on
<html>), but it now only reacts to `theme` state changes - no
synchronous setState in the effect body.

The 'Commander' default display name (last sci-fi cosplay residual,
post-#163/#168) became 'Friend'.

AdvancedSettings inner panel had its own setState-in-effect that
read advanced_mode from localStorage. Hoisted to a lazy initializer
the same way.

| Change | File:line |
|---|---|
| 7-setState mount effect → useMemo + lazy initializers | settings/page.tsx:38-56 |
| 'Commander' default → 'Friend' | settings/page.tsx:23 |
| AdvancedSettings setAdvancedMode in effect → lazy initializer | settings/page.tsx:412-417 |

## Verified

- pnpm exec tsc --noEmit: clean
- pnpm check: 3 passed, 0 failed
- pnpm lint: 85 problems / 19 errors (was 87 / 21)

## Rollback

Single git revert.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 28, 2026

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

Project Deployment Actions Updated (UTC)
website Ready Ready Preview, Comment Apr 28, 2026 1:09am

@operatoruplift operatoruplift merged commit 614ef3c into master Apr 28, 2026
4 checks passed
operatoruplift added a commit that referenced this pull request Apr 28, 2026
PR #168 retired the "Commander" default in /api/auth/signup. PR #186
retired it in /settings page. But four more places still stamped
"Commander" on a fresh user's account:

| File | Surface |
|---|---|
| app/(auth)/signup/page.tsx:35 | localStorage 'user' write after Supabase signup |
| app/(auth)/login/page.tsx:60 | userName fallback after Privy login |
| app/(auth)/login/page.tsx:165 | localStorage 'user' write after wallet payment |
| app/(dashboard)/profile/page.tsx:11 | initial useState for the profile page |
| app/(dashboard)/onboarding/page.tsx:43 | onboarding's saved user.name |

Each now derives a default from the email's local part (jane@x.com
-> "jane") or falls back to "Friend" -- matching the pattern set in
#168.

The two comment hits left in the repo (chat/page.tsx + the
auth/signup route) explicitly DOCUMENT what was retired and stay.

After this merges:
  grep -rnE "'Commander'" app/ src/
returns zero non-comment hits.

## Verified

- pnpm exec tsc --noEmit: clean
- pnpm check: 3 passed, 0 failed
- Banned-vocab grep: 0 user-facing hits

## Rollback

Single git revert. 4 files.
operatoruplift added a commit that referenced this pull request Apr 28, 2026
… pages (#192)

Two new specs added to consumer-copy.spec.ts so the post-#190/#191
state can't drift back.

## "JSON-LD structured data uses the consumer pitch"

PR #190 rewrote the schema.org SoftwareApplication description blob
that Google reads for rich-result snippets. The old text was:
"Local-first AI agent platform with secure, private memory. Build,
deploy, and monetize autonomous agents, no cloud required."

Now the test:
- Asserts the new "drafts your email" pitch IS in the JSON-LD
- Asserts the old "Local-first AI agent platform" + "autonomous
  agents" strings are NOT

## "/login + /signup auth pages do not show 'Commander'"

PRs #168, #186, and #191 retired "Commander" across the API + 5
client surfaces. The auth pages are the funnel where a fresh user
landed - this spec verifies neither /login nor /signup ever shows
the word, and also verifies "Local-first" stays out (the auth
footer pill rows used to say it; #190 fixed that).

## Verified

- pnpm exec tsc --noEmit: clean
- pnpm exec playwright test consumer-copy.spec.ts: 8 passed (37.3s)

## Rollback

Single git revert. One file.
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.

1 participant