wrolpi/app/src/hooks
Roland 07af0c9f28 controller: de-duplicate the hardware toggles
The Hotspot, Bluetooth, Desktop, VNC and Throttle toggles had each been written
out longhand at four layers. Collapse the shared parts:

- useSubsystemToggle() replaces five near-identical hooks. This also fixes a
  latent bug: only useDesktop/useVnc restored state when a request failed, so a
  failed Bluetooth/Throttle/Hotspot toggle left  at null and — since the
  status poll sees no change — the toggle stayed disabled and read as
  unsupported until it remounted.
- SubsystemToggle renders all five, with the Desktop's stop confirmation and
  VNC's desktop gating as declared options rather than bespoke copies.
- The fallback UI's four update*/toggle* pairs become one config-driven
  implementation (-100 lines).
- _raise_for_action() centralises the 13 endpoint failure checks, including
  VNC's 409-vs-500 split.

Deliberately not shared: the six get_*_status_dict() builders (payloads
genuinely differ) and the per-subsystem mechanisms (nmcli/rfkill/sysfs/systemctl).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-29 19:48:08 -06:00
..
customHooks.js controller: de-duplicate the hardware toggles 2026-07-29 19:48:08 -06:00
customHooks.test.js Warning when SMART reports unreadable sectors. Parse Seagate drive hours correctly. 2026-06-24 15:59:34 -06:00
useForm.js app: handle form fetch failures without unhandled rejection 2026-07-16 19:40:28 -06:00
useForm.test.js app: handle form fetch failures without unhandled rejection 2026-07-16 19:40:28 -06:00
useKeyboardShortcuts.test.js Adding keyboard shortcuts to UI. 2025-12-26 18:59:20 -07:00
useOverflowNav.js Navigation links automatically hide based on screen width, rather than hard breaks. 2026-04-09 16:17:38 -06:00
useSubsystemToggle.test.js controller: de-duplicate the hardware toggles 2026-07-29 19:48:08 -06:00