You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tooltip callback ref resets on unchanged rerenders #5949
useTooltip() returns a new callback ref after an otherwise unchanged rerender. When a consumer passes that callback to a trigger, React calls the old ref with null and the new ref with the element, causing Tooltip to remove and re-add its pointer, mouse, and focus listeners and repeat its anchor wiring.
Reproduction
const{result, rerender}=renderHook(()=>useTooltip());constfirstRef=result.current.ref;rerender();expect(result.current.ref).toBe(firstRef);// fails on current main
Cause
Tooltip callbacks depend on the object returned by useTouchTrigger and on the complete useLayer result. Those objects can change while the callback members Tooltip uses remain unchanged, invalidating interactionRef and the combined ref.
Expected
Tooltip callback refs remain stable when the behavior that their listeners capture has not changed.
Activity
perf(HoverCard): keep trigger refs stable across rerenders (#6606)