Skip to content

Commit

Permalink
fix: do not use Link if no to value
Browse files Browse the repository at this point in the history
  • Loading branch information
adrians5j committed Jan 14, 2025
1 parent bd68f63 commit 0b0ce8b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion extensions/theme/src/layouts/pages/Static/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ export const Navigation: React.ComponentType<{ data?: PublishedMenuData }> = ({
);
}

// We only use the Link component if the item has a `path` or `url` value.
const link = item.path || item.url;
return (
<li key={item.id + index}>
<Link to={item.path || item.url}>{item.title}</Link>
{link ? <Link to={link}>{item.title}</Link> : item.title}
</li>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ export const Navigation: React.ComponentType<{ data?: PublishedMenuData }> = ({
);
}

// We only use the Link component if the item has a `path` or `url` value.
const link = item.path || item.url;
return (
<li key={item.id + index}>
<Link to={item.path || item.url}>{item.title}</Link>
{link ? <Link to={link}>{item.title}</Link> : item.title}
</li>
);
})}
Expand Down

0 comments on commit 0b0ce8b

Please sign in to comment.