Skip to content

Commit

Permalink
fix conditional useHref call (adobe#7032)
Browse files Browse the repository at this point in the history
Co-authored-by: Abel John <[email protected]>
Co-authored-by: Robert Snow <[email protected]>
Co-authored-by: Daniel Lu <[email protected]>
  • Loading branch information
4 people committed Sep 19, 2024
1 parent 988b4d4 commit 097c8fc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/@react-aria/utils/src/openLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,9 @@ function openSyntheticLink(target: Element, modifiers: Modifiers) {

export function useSyntheticLinkProps(props: LinkDOMProps) {
let router = useRouter();
const href = router.useHref(props.href ?? '');
return {
'data-href': props.href ? router.useHref(props.href) : undefined,
'data-href': props.href ? href : undefined,
'data-target': props.target,
'data-rel': props.rel,
'data-download': props.download,
Expand All @@ -172,8 +173,9 @@ export function getSyntheticLinkProps(props: LinkDOMProps) {

export function useLinkProps(props: LinkDOMProps) {
let router = useRouter();
const href = router.useHref(props?.href ?? '');
return {
href: props?.href ? router.useHref(props?.href) : undefined,
href: props?.href ? href : undefined,
target: props?.target,
rel: props?.rel,
download: props?.download,
Expand Down

0 comments on commit 097c8fc

Please sign in to comment.