Skip to content

Commit

Permalink
Merge pull request #899 from near/fix_custom_href_links
Browse files Browse the repository at this point in the history
fix: custom Link element should handle when href is undefined
  • Loading branch information
charleslavon authored Jan 2, 2024
2 parents d107f81 + f3b747f commit 1d5b5af
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/components/vm/VmInitializer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export default function VmInitializer() {
Link: ({ to, href, ...rest }: { to: string | object | undefined; href: string | object }) => {
const cleanProps = mapValues({ to, href, ...rest }, (val: any, key: string) => {
if (!['to', 'href'].includes(key)) return val;
if (key === 'href' && !val) val = to;
return typeof val === 'string' && isValidAttribute('a', 'href', val) ? val : 'about:blank';
});

Expand Down

0 comments on commit 1d5b5af

Please sign in to comment.