solid-react-components icon indicating copy to clipboard operation
solid-react-components copied to clipboard

Avoid withWebId passing undefined when the user is authenticated

Open janjaromirhorak opened this issue 5 years ago • 1 comments

When the user is authenticated and withWebId is used on a component, the component is first rendered with withWebId set to undefined and then the prop is changed to the correct user WebId.

The preferred behavior would be to pass the user's webId on the first render.

A very simplified example:

export default MyComponent = withWebId(({webId}) => (
    webId ? <LoggedInComponent/> : <LoggedOutComponent/>
);

On each mount with an authenticated user the LoggedOutComponent is rendered first and then it is replaced by the LoggedInComponent. I would expect only the LoggedInComponent to be rendered.

I'm pretty new to Solid and solid-react-components, so I'm sorry if there is something I misunderstood or used differently that it was designed to work.

janjaromirhorak avatar Feb 16 '20 15:02 janjaromirhorak

Hello and thanks for reporting this! It does seem like an issue that should be addressed. The components in question, withWebId, LoggedInComponent, and LoggedOutComponent are actually just wrappers around another library called solid/react-components (not to be confused with this repo, the inrupt/solid-react-components).

Can you please open an issue on that repo with the same information? We can use this ticket as a reminder to update the library once the fix is in place.

james-martin-jd avatar Feb 24 '20 14:02 james-martin-jd