fix(web): hooks-warnings batch 1 — static-components, purity, immutability to zero - #117
Merged
Merged
Conversation
…ility to zero First burn-down batch of the React-Compiler hooks warnings (163 -> 141, CI ratchet lowered to match). static-components (14, real remount bugs): SortIcon (geographic- performance), SortIndicator (VulnerabilityReportSection) and SearchIcon/ ResultsDropdown (GlobalSearch) were defined inside render — a new component type every render, so React unmounted and rebuilt their subtrees each time (GlobalSearch tore down its dropdown on every keystroke). All hoisted to module level with explicit props. purity (6): Date.now() during render replaced with mount-time clocks (useState lazy init) for the date-input caps (Maintenance sections) and trial-expiry checks (TenantManagement, SectionTenantConfigReport); FeedbackSection refreshes its clock per fetch so "Xm ago" labels track the data; DownloadProgress falls back to NaN instead of wall-clock for unparseable event timestamps (rate calc already guards via Number.isFinite). immutability (5): fetch functions were declared below the effects that call them — moved above (diagnosis, fleet-health, DistressReports). This unblocked deeper compiler analysis, surfacing 3 latent set-state-in-effect findings in those files (93 -> 96); they belong to the set-state category and stay for its own batch. Verified: eslint 0 errors / 141 warnings (gate exits 0), tsc clean, vitest 611/611, static export builds. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
First burn-down batch of the React-Compiler hooks warnings: 163 → 141, CI
--max-warningsratchet lowered to match. Targets the categories with real bug risk per finding, per the agreed prioritization.static-components(14 → 0) — real remount bugs:SortIcon(geographic-performance),SortIndicator(VulnerabilityReportSection) andSearchIcon/ResultsDropdown(GlobalSearch) were defined inside render — a new component type on every render, so React unmounted and rebuilt their subtrees each time (GlobalSearch tore down its results dropdown on every keystroke). All hoisted to module level with explicit props.purity(6 → 0):Date.now()during render replaced with mount-time clocks (useStatelazy init) for the date-input caps (Maintenance sections) and trial-expiry checks (TenantManagement, SectionTenantConfigReport). FeedbackSection refreshes its clock per fetch so the "Xm ago" labels track the data they describe. DownloadProgress falls back toNaNinstead of wall-clock for unparseable event timestamps (the rate calculation already guards viaNumber.isFinite).immutability(5 → 0): fetch functions were declared below the effects that call them (diagnosis, fleet-health, DistressReports) — moved above the effects, no other changes.Note: the immutability fixes unblocked deeper compiler analysis in those 3 files, surfacing 3 latent
set-state-in-effectfindings (93 → 96). They belong to the set-state category and stay for its own batch — nothing got worse, it just became visible.Verification
tsc --noEmitclean, vitest 611/611, static export builds🤖 Generated with Claude Code