Skip to content

Commit

Permalink
[sparkle] Add prefetch prop for next/link (#9573)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdraier authored Dec 20, 2024
1 parent 3037491 commit 21439c9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions sparkle/src/components/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ const DropdownMenuItem = React.forwardRef<
asChild,
replace,
shallow,
prefetch,
...props
},
ref
Expand All @@ -220,6 +221,7 @@ const DropdownMenuItem = React.forwardRef<
rel={rel}
replace={replace}
shallow={shallow}
prefetch={prefetch}
>
<ItemWithLabelIconAndDescription
label={label}
Expand Down
4 changes: 3 additions & 1 deletion sparkle/src/components/LinkWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ export interface LinkWrapperProps {
replace?: boolean;
shallow?: boolean;
target?: string;
prefetch?: boolean;
}

export const LinkWrapper = React.forwardRef<
HTMLAnchorElement,
LinkWrapperProps
>(({ children, href, rel, replace, shallow, target }, ref) => {
>(({ children, href, rel, replace, shallow, target, prefetch }, ref) => {
const { components } = React.useContext(SparkleContext);

if (href) {
Expand All @@ -26,6 +27,7 @@ export const LinkWrapper = React.forwardRef<
rel={rel}
replace={replace}
shallow={shallow}
prefetch={prefetch}
>
{children}
</components.link>
Expand Down
1 change: 1 addition & 0 deletions sparkle/src/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type SparkleLinkProps = {
shallow?: boolean;
target?: string;
rel?: string;
prefetch?: boolean;
};

export type SparkleContextLinkType = ComponentType<
Expand Down

0 comments on commit 21439c9

Please sign in to comment.