summaryrefslogtreecommitdiff
path: root/src/components/shared/ToggleSwitch.tsx
AgeCommit message (Collapse)Author
2026-08-20refactor: enable strictNullChecksLarvan2
Closes the last hole in `strict`. 76 sites; most were types that quietly claimed a value could never be null while the code already coped with it, or the reverse. The single highest-leverage fix was StateProvider's three createContext(null) calls, which typed the whole store as null and produced "Property 'app' does not exist on type 'null'" in seven files. Types corrected to match what the backend and the code actually produce, rather than papered over: - SubscriptionInfo's four fields, FormattedConn's startTime and the two SpeedCurr fields: written unconditionally at every site, never optional. - Rule, ToggleSwitch and Selection2 marked every prop optional and then used all of them unconditionally; callers always pass them. - TunPartial did not account for the optional modifier, so `tun?: ClashTunConfig` failed `extends ClashTunConfig` and the sub-tree was never made partial. Behaviour changes, all of them hardening: - buildWebSocketURL sent the literal string "undefined" as the token when no secret was configured. It now omits the parameter. Byte-identical output when a secret is present. - The /logs, /traffic and /memory fetch fallbacks now check response.body before calling getReader() on it. - ConnectionCard rendered prettyBytes(undefined) for a connection's first frame; getLabelColor relied on `undefined < 800` being false to fall through to the "unavailable" colour. Both are now written out. Verified against a live backend: 1630 proxy elements with the same latency colour distribution, connections filter, logs streaming, config selects, all with an empty console.
2026-08-20chore: reorganize codeLarvan2