mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-17 12:22:34 +03:00
* chore(lint): batch 3 of #12146 — resolve the react-hooks compiler violations in dashboard/settings Resolves the 25 react-hooks/* React Compiler violations frozen in config/quality/eslint-suppressions.json for the dashboard/settings area (24 set-state-in-effect, 1 immutability), plus the adjacent react-hooks/exhaustive-deps in ProviderAccountRoutingCard, and removes their suppression entries. No eslint-disable added anywhere; one pre-existing eslint-disable-line (AccessTokensTab) removed. Techniques used: - ResilienceTab (8×): the "sync draft state from prop via useEffect" cards now use the documented adjust-state-during-render pattern (prevValue state + conditional setState in render) instead of an effect. - PricingTab visibleCount reset: same render-adjustment pattern keyed on the filters tuple, replacing the reset effect. - Fetch-on-mount loaders only used by the effect (IPFilterSection, ModelCapabilityOverridesTab, PayloadRulesTab*, RoutingStrategyCard): loader inlined into the effect as an async IIFE with a cancelled flag; every setState now happens after the first await. - Loaders reused by handlers/intervals (AccessTokensTab, AuthzSection, FallbackChainsEditor, MitmProxyTab, ModelsDevSyncTab, OneproxyTab, PayloadRulesTab, PoliciesPanel, PricingTab, ProviderAccountRoutingCard, SystemStorageTab, GlobalConfigTab, SubscriptionTab): split into a module-level pure fetcher + a useCallback applier; the effect awaits the fetcher and applies after the await (cancellation-guarded), while handlers keep the original named loader (sync setState is fine there) built from the same fetcher/applier — no logic duplication, identical error-message and loading semantics. - OneproxyTab keeps the spinner-on-filter-change behavior via the same render-adjustment pattern (filtersKey → setLoading(true)). - AccessTokensTab: the L() fallback helper is now memoized with useCallback([t]), which also let the old eslint-disable-line react-hooks/exhaustive-deps be removed. - ProviderAccountRoutingCard: save's dependency array now includes load (the frozen exhaustive-deps violation). Suppressions: all react-hooks/* entries for the 17 batch files removed (19 rule entries, 26 violation counts). Entries for other rules/files untouched. Refs #12146 * chore(lint): batch 3 follow-up — extract useOneproxyData so the cyclomatic gate stays flat The first pass grew OneproxyTab past the complexity threshold (caught by the new-code gate on the PR); the data-loading state now lives in a dedicated useOneproxyData hook. Also registers search-432-plan-limit-cooldown in stryker tap.testFiles (base drift the gate flagged on every batch).