Skip to content

[BUG] #62

@rolandschuetz

Description

@rolandschuetz

Code Rabbit pointed out the following verified issue

⚠️ Potential issue | 🟠 Major

Remove triggerRef.current from the deps array.

Including triggerRef.current in the dependency array violates React rules. Ref mutations don't trigger re-renders, and the .current property should not be tracked in dependency arrays. This can lead to stale closures or unexpected behavior.

Apply this diff to fix the issue:

 const rootRef = useAugmentedRef({
     ref: ref as React.Ref<ContextMenuMethods>,
     methods: {
         presentMenu: () => {
             triggerRef.current?.open();
         },
         dismissMenu,
     },
  •    deps: [triggerRef.current],
    
  •    deps: [],
    
    });

@src/components/nativewindui/ContextMenu/ContextMenu.tsx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions