okp4 / dataverse-portal

🔭 Dataverse Portal for the OKP4 network.
BSD 3-Clause "New" or "Revised" License
8 stars 1 forks source link

Fix/popover component #487

Closed loiclaudet closed 1 year ago

loiclaudet commented 1 year ago

Issue

The problem lies in using refs, which don't trigger re-renders in React.

When popover-root DOM element is retrieved in useEffect, the component doesn't re-render, and as a result, the popover content isn't displayed.

This bug is currently masked when the Popover's parent component triggers a re-render.

Fix

Use a useState hook that triggers a component re-render as soon as the popover-root DOM element is found.