Skip to content

refactor(runtime): extract first-run onboarding into useOnboarding (#1237)#1279

Merged
gfargo merged 1 commit into
mainfrom
feat/app-decompose-onboarding
Jun 15, 2026
Merged

refactor(runtime): extract first-run onboarding into useOnboarding (#1237)#1279
gfargo merged 1 commit into
mainfrom
feat/app-decompose-onboarding

Conversation

@gfargo

@gfargo gfargo commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Item 4 — app.ts decomposition (#1237)

Bundles the first-launch onboarding overlay's show / dismiss / persistence into a new useOnboarding hook.

What moved

  • showOnboarding — the useState, seeded verbatim from !hasSeenOnboarding().
  • dismissOnboarding — a stable useCallback that clears the overlay and writes the seen-marker: setShowOnboarding(false) then markOnboardingSeen(), same order as the old inline code.

Ripple into useInputHandler

The handler previously received setShowOnboarding + markOnboardingSeen and called both inline on the first keystroke. It now takes the single dismissOnboarding callback and calls it — same two operations, same order, behavior unchanged. This also removes the onboarding-persistence imports from app.ts.

Changes

  • New hooks/useOnboarding.ts.
  • app.ts: useStateuseOnboarding(React); drop hasSeenOnboarding/markOnboardingSeen import; thread dismissOnboarding into the input handler.
  • useInputHandler.ts: swap the two onboarding deps for dismissOnboarding; collapse the two inline calls.
  • New hooks/useOnboarding.test.ts — seed (first launch vs returning) + dismiss (clears + persists).

Validation

  • jest (workstation): 111 suites / 1874 tests pass, 68 snapshots no diffs
  • tsc --noEmit: clean · eslint: 0 errors · rollup -c: builds dist/

…1237)

Item 4 of the app.ts decomposition. Bundles the first-launch overlay's show /
dismiss / persistence into a new `useOnboarding` hook:

- owns `showOnboarding`, seeded verbatim from `!hasSeenOnboarding()`;
- returns `dismissOnboarding`, a stable `useCallback` that clears the overlay
  and writes the seen-marker (`setShowOnboarding(false)` then
  `markOnboardingSeen()`, same order as before).

`app.ts` no longer holds the `useState` or imports the onboarding persistence
helpers; it renders the overlay off `showOnboarding` and threads
`dismissOnboarding` into `useInputHandler`, which now takes that one callback
instead of `setShowOnboarding` + `markOnboardingSeen` and calls it on the first
keystroke. Behavior is unchanged. Adds tests for the seed (first launch vs
returning) and the dismiss (clears + persists).
@gfargo gfargo merged commit e948dcf into main Jun 15, 2026
15 checks passed
@gfargo gfargo deleted the feat/app-decompose-onboarding branch June 15, 2026 15:42
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