Skip to content

refactor: Fix React Compiler violations in Menu #1068

Description

@frankieyan

Part of #1066.

  • File: src/menu/menu.tsx
  • Violations: Hooks must be the same function on every render ×2 (Error, lines 134 and 165): both are menuStore.useState('open') (AriaKit store hook reached through a mutable object).

Steps

  1. Reproduce and confirm both violations.
  2. Fix: migrate menuStore.useState('open') to useStoreState(menuStore, 'open') from @ariakit/react, per #conditional-hook-calls. The same migration covers refactor: Fix React Compiler violation in Tooltip #1069 (tooltip) and refactor: Fix React Compiler violations in Tabs #1070 (tabs); not a dependency (the compiler runs per-module), but the three can land in one PR.
  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