Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove "to" prop if component is <a> #3654

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/shared/AppLink/AppLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ function useCompleteProps(

const propsLink = pageConfig?.isExternalLink
? { href: path }
: Component === 'a'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just the same thing as isExternalLink being defined

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least from testing this looked to be the case

? { href: path }
: { to: path || '/' }
: { to: path || '/' }

const propsTarget = pageConfig?.openNewTab ? { target: '_blank' } : {}
const propsActive = Component === NavLink ? { activeClassName } : {}
Expand All @@ -45,6 +43,7 @@ function useCompleteProps(
...propsTarget,
...props,
...propsActive,
...(Component === 'a' && { to: undefined }),
}
}

Expand Down
Loading