fix(SW-2754): Fixed issue where server rendered html included faulty links

Approved-by: Matilda Landström
This commit is contained in:
Erik Tiekstra
2025-05-16 06:21:09 +00:00
parent 4f8483305d
commit 2401615caa
12 changed files with 67 additions and 78 deletions

View File

@@ -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)

View File

@@ -12,5 +12,4 @@ export interface LinkProps
trackingId?: string
trackingParams?: Record<string, string>
keepSearchParams?: boolean
appendToCurrentPath?: boolean
}