Remove two eslint-disable-next-line react-hooks/exhaustive-deps suppressions in apps/meteor/client/views/admin/settings/Setting/Setting.tsx by properly extracting (setting as ISettingColor).editor into a stable variable and listing it as a correct dependency.
Problem
The component currently suppresses the react-hooks/exhaustive-deps rule in two places:
- A
useEffect that syncs the editor state from setting.editor.
- The
onResetButtonClick useCallback, which also references (setting as ISettingColor).editor.
The suppressions exist because ESLint cannot track cast expressions such as (setting as ISettingColor).editor as valid hook dependencies. This results in unsafe dependency arrays and requires manual suppression.
Additionally, the cast introduces unnecessary type unsafety.
Notes
- Behavior must remain identical for both color and non-color settings.
- The extracted variable should return
undefined (not false) for non-color settings.
- Keep the change minimal and scoped to this file only.
Remove two
eslint-disable-next-line react-hooks/exhaustive-depssuppressions inapps/meteor/client/views/admin/settings/Setting/Setting.tsxby properly extracting(setting as ISettingColor).editorinto a stable variable and listing it as a correct dependency.Problem
The component currently suppresses the
react-hooks/exhaustive-depsrule in two places:useEffectthat syncs theeditorstate fromsetting.editor.onResetButtonClickuseCallback, which also references(setting as ISettingColor).editor.The suppressions exist because ESLint cannot track cast expressions such as
(setting as ISettingColor).editoras valid hook dependencies. This results in unsafe dependency arrays and requires manual suppression.Additionally, the cast introduces unnecessary type unsafety.
Notes
undefined(notfalse) for non-color settings.