Skip to content

refactor: Fix React Compiler violation in Tooltip #1069

Description

@frankieyan

Part of #1066.

  • File: src/tooltip/tooltip.tsx
  • Violation: Hooks must be the same function on every render (Error, line 136): tooltip.useState('open') (AriaKit store hook). Note: the child.ref access on line 147 is guarded by eslint-disable react-hooks/refs but does not currently produce a recorded compiler error.

Steps

  1. Reproduce and confirm the violation.
  2. Fix: migrate tooltip.useState('open') to useStoreState(tooltip, 'open') from @ariakit/react, per #conditional-hook-calls. Same migration as refactor: Fix React Compiler violations in Menu #1068 (menu) and refactor: Fix React Compiler violations in Tabs #1070 (tabs); can be batched into one PR.
  3. Confirm the count dropped; let the hook update the record file.
  4. Verify memoization in the compiled output.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions