Skip to content

Fix exhaustive-deps Suppressions in Setting.tsx #39112

@Agarwalchetan

Description

@Agarwalchetan

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:

  1. A useEffect that syncs the editor state from setting.editor.
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions