fix(SW-2754): Fixed issue where server rendered html included faulty links
Approved-by: Matilda Landström
This commit is contained in:
@@ -32,7 +32,6 @@ export default function Link({
|
||||
* in your component that passes the href here.
|
||||
*/
|
||||
keepSearchParams,
|
||||
appendToCurrentPath,
|
||||
...props
|
||||
}: LinkProps) {
|
||||
const currentPageSlug = usePathname()
|
||||
@@ -55,9 +54,6 @@ export default function Link({
|
||||
|
||||
const fullUrl = useMemo(() => {
|
||||
let newPath = href
|
||||
if (appendToCurrentPath) {
|
||||
newPath = `${currentPageSlug}${newPath}`
|
||||
}
|
||||
|
||||
if (keepSearchParams && searchParams.size) {
|
||||
if (newPath.includes("?")) {
|
||||
@@ -74,13 +70,7 @@ export default function Link({
|
||||
}
|
||||
|
||||
return newPath
|
||||
}, [
|
||||
href,
|
||||
searchParams,
|
||||
keepSearchParams,
|
||||
appendToCurrentPath,
|
||||
currentPageSlug,
|
||||
])
|
||||
}, [href, searchParams, keepSearchParams])
|
||||
|
||||
// TODO: Remove this check (and hook) and only return <Link /> when current web is deleted
|
||||
const isExternal = useCheckIfExternalLink(href)
|
||||
|
||||
@@ -12,5 +12,4 @@ export interface LinkProps
|
||||
trackingId?: string
|
||||
trackingParams?: Record<string, string>
|
||||
keepSearchParams?: boolean
|
||||
appendToCurrentPath?: boolean
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user