From 722d31404a7d0ddbd6c2a08087d35a17fe435442 Mon Sep 17 00:00:00 2001 From: Chris Arderne Date: Wed, 19 Aug 2026 10:29:28 +0100 Subject: [PATCH 1/2] fix(webapp,react-hooks): enforce stable hook ordering --- .oxlintrc.json | 9 ++++- .../app/components/primitives/Switch.tsx | 20 +++++------ .../app/components/primitives/TextLink.tsx | 18 +++++----- .../route.tsx | 15 +++----- .../route.tsx | 14 ++++---- packages/react-hooks/src/hooks/useRealtime.ts | 36 +++++++++---------- 6 files changed, 53 insertions(+), 59 deletions(-) diff --git a/.oxlintrc.json b/.oxlintrc.json index 92402d316f3..6cb4b6885ff 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -46,7 +46,7 @@ "import/no-duplicates": "error", "import/namespace": "off", "react-hooks/exhaustive-deps": "off", - "react-hooks/rules-of-hooks": "off", + "react/rules-of-hooks": "off", "guard-for-in": "error", "symbol-description": "error", "no-unneeded-ternary": "error", @@ -115,10 +115,17 @@ { "files": ["apps/webapp/app/**/*.ts", "apps/webapp/app/**/*.tsx"], "rules": { + "react/rules-of-hooks": "error", "trigger-runops/no-control-plane-run-graph-access": "error", "trigger-runops/no-control-plane-in-runops-slot": "error" } }, + { + "files": ["packages/react-hooks/src/**/*.ts", "packages/react-hooks/src/**/*.tsx"], + "rules": { + "react/rules-of-hooks": "error" + } + }, { "files": ["apps/webapp/app/**/*.test.ts", "apps/webapp/app/**/*.test.tsx"], "rules": { diff --git a/apps/webapp/app/components/primitives/Switch.tsx b/apps/webapp/app/components/primitives/Switch.tsx index e07187176a8..99c8e4043b9 100644 --- a/apps/webapp/app/components/primitives/Switch.tsx +++ b/apps/webapp/app/components/primitives/Switch.tsx @@ -68,17 +68,15 @@ export const Switch = React.forwardRef { - if (innerRef.current) { - innerRef.current.click(); - } - }, - disabled: props.disabled, - }); - } + useShortcutKeys({ + shortcut: props.shortcut, + action: () => { + if (innerRef.current) { + innerRef.current.click(); + } + }, + disabled: props.disabled, + }); const labelElement = label ? (