Skip to content

[React-ARIA] - Maximum update depth exceeded while building popover component with render props #2450

Answered by snowystinger
bstro asked this question in Q&A
Discussion options

You must be logged in to vote

I think if you are seeing it fixed when you do not attach a popoverRef, then you are causing something where the actual node that popoverRef is attached to keeps changing. It's a bit hard to follow all of the render props around, but you can see that you're generating a new node constantly if you put this line of code into your PopoverWithTrigger just after the useOverlayTrigger

  let prevTrigger = useRef();
  if (prevTrigger.current && triggerRef.current) {
    console.log('trigger', triggerRef.current.isSameNode(prevTrigger.current))
  }
  useEffect(() => {
    if (triggerRef.current) {
      // @ts-ignore
      prevTrigger.current = triggerRef.current;
    }
  }, [triggerRef.current]);

Replies: 1 comment 18 replies

Comment options

You must be logged in to vote
18 replies
@snowystinger
Comment options

@bstro
Comment options

@snowystinger
Comment options

@bstro
Comment options

@bstro
Comment options

Answer selected by bstro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants