mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-14 02:42:24 +03:00
* chore(lint): batch 5 of #12146 — resolve the react-hooks compiler violations in combos, endpoint, provider-stats, api-manager and costs 40 violations across 14 files, all real refactors (no eslint-disable, no new suppressions; the areas' react-hooks entries are deleted from the freeze): - set-state-in-effect (30): fetch-on-mount effects moved behind an async continuation (usePools, usePoolUsage, useApiKeyUsageLimits, Notion/Obsidian source cards, A2A/MCP dashboards, ComboControlCenterClient, provider-stats, combos modal loaders, ApiManager initial load); prop/state sync converted to state adjustment during render with prev tracking (ApiKeyUsageLimitCard, PoolWizard dimensions/reset/group snap, combos sortMethod, builder reset, builder stage guard, single-provider default, stale intelligent selection); localStorage reads became lazy useState initializers (combos usage guide). - immutability / TDZ (8): effects that scheduled fetchers declared below them moved after the declarations (EndpointPageClient, ApiManagerPageClient, combos mount load); fetchData relocated below the per-key fetchers it calls. - static-components (7): provider-stats SortIcon hoisted to module level. - preserve-manual-memoization (2): ApiManager blockedModels dep destructured to a local; provider-scope derivation memoized so downstream memos see a stable dependency. Validation: eslint (CI command with suppressions, --max-warnings 0) clean on the 14 files; dashboard typecheck within baseline; mutation gate no drift; area tests 208/208 (node) + 29/29 (vitest). Refs #12146 * chore(lint): batch 5 follow-up — hoist the render-adjustment predicates so the new-code complexity gates stay flat The render adjustments added one cyclomatic branch to combos/page.tsx and one cognitive point to PoolWizard (caught by the new-code gate on the committed work); the compound conditions now live in pure module-level predicates. * chore(lint): batch 5 follow-up 2 — PoolWizard render adjustments live in two small hooks One consolidated hook tripped max-lines-per-function (>80) and the cognitive budget; the dimensions and open/close adjustments now live in two focused hooks with a shared WizardSetters type, and the group snap stays inline (one branch). complexityNewCode=0, cognitiveComplexityNewCode=0. * test(quota): repoint the two PoolWizard structural pins at the render-adjustment hook quota-edit-opens-wizard anchored the pre-fill block on the old '} else if (editPool)' effect literal and quota-pool-wizard-edit expected a bare 'if (editPool)' that only existed there; both now anchor on the batch-5 structure (submit still branches via if (!editPool)).