This issue is most likely not related to this component but I document it here in case someone else has the same issue.
On page changes we pass different collection and ID values to the component. The component always gets fully re-rendered i.e. user changes to undefined and a network request is needed to get the user. This leads to some flickering: admin bar disappears and renders again once the user is known again.
Most likely this is a Next.js issue. The component looks fine and should only load the user once. Will update this ticket once I have more details.
This issue is most likely not related to this component but I document it here in case someone else has the same issue.
On page changes we pass different collection and ID values to the component. The component always gets fully re-rendered i.e. user changes to undefined and a network request is needed to get the user. This leads to some flickering: admin bar disappears and renders again once the user is known again.
Most likely this is a Next.js issue. The component looks fine and should only load the user once. Will update this ticket once I have more details.