Skip to content

refactor: Fix React Compiler violation in useForkRef #1071

Description

@frankieyan

Part of #1066.

  • File: src/checkbox-field/use-fork-ref.ts
  • Violation: React Compiler skipped optimizing this component because one or more React ESLint rules were disabled (Error, line 33): the eslint-disable react-hooks/exhaustive-deps, react-hooks/use-memo on the manual useMemo (keyed on a spread refs array) makes the compiler skip the module.

Steps

  1. Reproduce and confirm the violation.
  2. Remove the disabled rules and restructure the ref-merging so it is compiler-compatible, per #mismatched-usememo-dependencies. Do not drop the manual useMemo until the violation is gone.
  3. Confirm the count dropped; let the hook update the record file.
  4. Verify memoization in the compiled output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No 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