Skip to content

Commit fdad040

Browse files
committed
fix(site): failing build
1 parent 560fe89 commit fdad040

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

apps/site/src/components/navigation-wrapper.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { WebNavigation } from "@prisma-docs/ui/components/web-navigation";
44
import { Footer } from "@prisma-docs/ui/components/footer";
55
import { useEffect, useState } from "react";
6-
import { usePathname, useSearchParams } from "next/navigation";
6+
import { usePathname } from "next/navigation";
77
import {
88
getUtmParams,
99
readStoredUtmParams,
@@ -56,13 +56,14 @@ function getUtmMedium(pathname: string) {
5656

5757
export function NavigationWrapper({ links, utm }: NavigationWrapperProps) {
5858
const pathname = usePathname();
59-
const searchParams = useSearchParams();
6059
const [storedUtmParams, setStoredUtmParams] = useState<UtmParams>({
6160
utm_source: utm.source,
6261
});
6362

6463
useEffect(() => {
65-
const currentUtmParams = getUtmParams(new URLSearchParams(searchParams.toString()));
64+
const currentUtmParams = getUtmParams(
65+
new URLSearchParams(window.location.search),
66+
);
6667

6768
if (currentUtmParams.utm_source) {
6869
setStoredUtmParams(currentUtmParams);
@@ -76,7 +77,7 @@ export function NavigationWrapper({ links, utm }: NavigationWrapperProps) {
7677
? persistedUtmParams
7778
: { utm_source: utm.source },
7879
);
79-
}, [searchParams, utm.source]);
80+
}, [pathname, utm.source]);
8081

8182
// Determine button variant based on pathname
8283
const getButtonVariant = (): ColorType => {

apps/site/src/components/utm-persistence.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

33
import { useEffect } from "react";
4-
import { usePathname, useSearchParams } from "next/navigation";
4+
import { usePathname } from "next/navigation";
55
import {
66
getUtmParams,
77
hasUtmParams,
@@ -12,10 +12,11 @@ import {
1212

1313
export function UtmPersistence() {
1414
const pathname = usePathname();
15-
const searchParams = useSearchParams();
1615

1716
useEffect(() => {
18-
const currentUtmParams = getUtmParams(new URLSearchParams(searchParams.toString()));
17+
const currentUtmParams = getUtmParams(
18+
new URLSearchParams(window.location.search),
19+
);
1920

2021
if (hasUtmParams(currentUtmParams)) {
2122
writeStoredUtmParams(currentUtmParams);
@@ -39,7 +40,7 @@ export function UtmPersistence() {
3940
"",
4041
`${currentUrl.pathname}${currentUrl.search}${currentUrl.hash}`,
4142
);
42-
}, [pathname, searchParams]);
43+
}, [pathname]);
4344

4445
useEffect(() => {
4546
function handleClick(event: MouseEvent) {

0 commit comments

Comments
 (0)