Skip to content

refactor(renderer): shared useMountedRef + last formatBytes fork (Round D-1) - #871

Merged
jackwener merged 1 commit into
mainfrom
chore/frontend-simplify-round-d
Jul 13, 2026
Merged

refactor(renderer): shared useMountedRef + last formatBytes fork (Round D-1)#871
jackwener merged 1 commit into
mainfrom
chore/frontend-simplify-round-d

Conversation

@jackwener

Copy link
Copy Markdown
Member

Round D-1 of notes/frontend-simplification-map-2026-07-13.md.

useMountedRef

The mounted-guard boilerplate (ref true on mount / false on unmount / checked before every post-await setState) was hand-rolled per component. Re-census (case-insensitive) puts it at ×38 sites, not the ×6 the map originally estimated. This round ships the primitive in @maka/ui and converts the 6 canonical sites (OnboardingHero ×2, password-input, daily-review / general / permission-center settings pages); components keep separate cleanup effects for their own companion refs only. 5 contracts re-pinned to the shared-hook form — read-side pins (mountedRef.current guards) survive untouched because the hook returns the same-named ref.

Deliberately not converted: use-workspace-instructions-controller (lifecycle-counter variant — not boilerplate) and app-shell.tsx (Round B agent owns that file). The ~30-site long tail is staged as Round D-2 in the map.

formatBytes

voice-settings-page's formatVoiceBytes was the last local fork (round-21 dedup killed the others) — replaced with the shared @maka/ui helper. Byte copy in the voice smoke toast gains one decimal of KB precision, matching every other surface.

Gates

desktop 2397/2397 · ui 125/125 · typecheck · knip ×2 = 0 · check-dead-css clean.

… removed (Round D-1)
The mounted-guard pattern (ref set true on mount, false on unmount, read
before every post-await setState/toast) was hand-rolled per component.
One hook in @maka/ui now owns the flag; components keep separate cleanup
effects only for their own companion refs. Contracts re-pinned to the
shared-hook form (first-run, settings-form-a11y, general-settings,
daily-review, roadmap-cleanup). voice-settings-page's formatVoiceBytes
was the last local fork of formatBytes — replaced with the @maka/ui
helper (round-21 dedup rationale). Map updated with the real ×38 census;
long tail staged as Round D-2.
@jackwener
jackwener merged commit 9cd718b into mainJul 13, 2026
1 of 3 checks passed
@Astro-Han
Astro-Han deleted the chore/frontend-simplify-round-d branch July 14, 2026 05:05
Astro-Han added a commit that referenced this pull request Jul 16, 2026
* docs: retire tracked notes into the archive
notes/ regrew tracked files after the archive README retired it as an
undocumented parallel authority. Move the simplification baseline map
(#871-#887) and the shipped composer-mentions v1 spec (#979) into
docs/archive/, register them under Former repository notes, and point
the citing source comments at the archived path.
* docs: archive computer-use chronicles and research records
The #857-#985 computer-use chain left one root document per PR:
follow-up fix records, an incident investigation, and run logs that
duplicate the kept contracts. Archive the seven chronicles, mark the
foundation contract validation matrix as the #857 split-gate baseline
(current state lives in source and contract tests), and register each
archived file in the archive README with a pointer to its current
authority.
Also archive the WorkBuddy/QoderWork reverse-engineering records (the
shipped design contract stays at docs/expert-team-runtime.md) and the
synthesis-cache benchmark log (progress belongs in issues #481/#578),
and fix the two surviving links to the moved paths.
* docs: map current contracts in the documentation README
Seventeen root documents existed outside the authority map with zero
incoming links. After archiving the chronicles, list the surviving
computer-use contracts and the expert-teams runtime contract, and
write down the maintenance rule that PR follow-up records, incident
investigations, and run logs belong in pull requests or the archive —
with notes/ and docs/local/ as untracked local scratch.
Sign up for freeto 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

@jackwener