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
If the field passed to the Link component has an undefined href, it will render undefined as a string in the dom.
To Reproduce
import {Link} from '@sitecore-jss/sitecore-jss-nextjs';
const field = {value: {href: undefined, text: 'This is a link with a href that is undefined'}};
<Link field={field} />
This will render a link like this:
<a href="undefined">This is a link with a href that is undefined</a>
Expected Behavior
I would expect the undefined href to be filtered out, leaving behind an anchor that with no href attribute.
E.g.
<a>This is a link with a href that is undefined</a>
Describe the Bug
If the field passed to the Link component has an undefined href, it will render undefined as a string in the dom.
To Reproduce
This will render a link like this:
Expected Behavior
I would expect the undefined href to be filtered out, leaving behind an anchor that with no href attribute.
E.g.
Possible Fix
On line 104, we should be checking for undefined
https://github.com/Sitecore/jss/blob/dev/packages/sitecore-jss-react/src/components/Link.tsx#L104
Provide environment information
The text was updated successfully, but these errors were encountered: