File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -14,17 +14,14 @@ import { DISCORD_PATH, SITE_URL } from "@/lib/constants"
14
14
import { useRtlFlip } from "@/hooks/useRtlFlip"
15
15
16
16
type BaseProps = {
17
- /** @deprecated Use `href` prop instead */
18
- to ?: string
19
- href ?: string
20
17
hideArrow ?: boolean
21
18
isPartiallyActive ?: boolean
22
19
activeClassName ?: string
23
20
customEventOptions ?: MatomoEventOptions
24
21
}
25
22
26
23
export type LinkProps = BaseProps &
27
- Omit < AnchorHTMLAttributes < HTMLAnchorElement > , "href" > &
24
+ AnchorHTMLAttributes < HTMLAnchorElement > &
28
25
Omit < NextLinkProps , "href" >
29
26
30
27
/**
@@ -41,8 +38,7 @@ export type LinkProps = BaseProps &
41
38
*/
42
39
export const BaseLink = forwardRef < HTMLAnchorElement , LinkProps > ( function Link (
43
40
{
44
- to,
45
- href : hrefProp ,
41
+ href,
46
42
children,
47
43
className,
48
44
hideArrow,
@@ -56,7 +52,10 @@ export const BaseLink = forwardRef<HTMLAnchorElement, LinkProps>(function Link(
56
52
const { asPath } = useRouter ( )
57
53
const { flipForRtl } = useRtlFlip ( )
58
54
59
- let href = ( to ?? hrefProp ) as string
55
+ if ( ! href ) {
56
+ console . warn ( "Link component is missing href prop" )
57
+ return < a { ...props } />
58
+ }
60
59
61
60
const isActive = url . isHrefActive ( href , asPath , isPartiallyActive )
62
61
const isDiscordInvite = url . isDiscordInvite ( href )
You can’t perform that action at this time.
0 commit comments