diff --git a/.oxlintrc.json b/.oxlintrc.json index 92402d316f3..aa066dc958f 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -45,8 +45,8 @@ "typescript/consistent-type-imports": "error", "import/no-duplicates": "error", "import/namespace": "off", - "react-hooks/exhaustive-deps": "off", - "react-hooks/rules-of-hooks": "off", + "react/exhaustive-deps": "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 ? (