Skip to content

Commit

Permalink
Adds missing ref
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-winter committed Aug 16, 2023
1 parent fc16a5f commit 6005c5c
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/routing/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,20 @@ export type LinkProps<
} & RouteArguments<TRouteParams, TRouteQuery, TRouteMeta> &
Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href" | "onClick">;

function LinkInner<TRoute extends AnyRoute>({
to,
children,
testId,
preloadOnHoverMs,
preloadOnInteraction,
onMouseDown: _onMouseDown,
onMouseEnter: _onMouseEnter,
onMouseLeave: _onMouseLeave,
...rest
}: LinkProps<TRoute>) {
function LinkInner<TRoute extends AnyRoute>(
{
to,
children,
testId,
preloadOnHoverMs,
preloadOnInteraction,
onMouseDown: _onMouseDown,
onMouseEnter: _onMouseEnter,
onMouseLeave: _onMouseLeave,
...rest
}: LinkProps<TRoute>,
ref: React.ForwardedRef<HTMLAnchorElement>
) {
// @ts-ignore, these fields _might_ exist, so typechecking doesn't believe they exist
// and everything that consumes params/query already checks for undefined
const { params, query, meta, ...props } = rest;
Expand Down Expand Up @@ -87,6 +90,7 @@ function LinkInner<TRoute extends AnyRoute>({
return (
<a
{...props}
ref={ref}
href={href}
data-testid={testId}
onMouseDown={onMouseDown ?? _onMouseDown}
Expand Down

0 comments on commit 6005c5c

Please sign in to comment.