Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e001ece

Browse files
committedMar 4, 2024·
Updated href to reference staticBasePath
1 parent 73d1269 commit e001ece

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed
 

‎src/ui/link/index.tsx

+3-11
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,8 @@ const Link = forwardRef<HTMLButtonElement | HTMLAnchorElement, LinkProps>(
7272
)) ||
7373
''
7474
: to;
75-
const hrefDestination =
76-
href != null
77-
? href
78-
: typeof to !== 'string'
79-
? (route &&
80-
createPath(
81-
generateLocationFromPath(route.path, routeAttributes)
82-
)) ||
83-
''
84-
: `${routeAttributes.basePath}${to}`;
75+
const staticBasePath =
76+
href == null && typeof to === 'string' ? routeAttributes.basePath : '';
8577

8678
const triggerPrefetch = useCallback(() => {
8779
// ignore if async route not ready yet
@@ -155,7 +147,7 @@ const Link = forwardRef<HTMLButtonElement | HTMLAnchorElement, LinkProps>(
155147
validLinkType,
156148
{
157149
...rest,
158-
href: hrefDestination,
150+
href: `${staticBasePath}${linkDestination}`,
159151
target,
160152
onClick: handleLinkPress,
161153
onKeyDown: handleLinkPress,

0 commit comments

Comments
 (0)
Please sign in to comment.