Skip to content

Commit 598df40

Browse files
committed
Fix: window not defined error fixed while build creation
1 parent 7cac4c4 commit 598df40

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
"use client";
22

3-
import { TheaProvider } from "@orderbook/core/providers";
3+
import dynamic from "next/dynamic";
44
import { useSearchParams } from "next/navigation";
55
import { ReactNode } from "react";
66

7+
const TheaLayout = dynamic(
8+
() => import("@/components/thea/TheaLayout").then((mod) => mod.TheaLayout),
9+
{ ssr: false }
10+
);
11+
712
export default function Layout({ children }: { children: ReactNode }) {
813
const params = useSearchParams();
914
const assetTicker = params.get("asset");
1015
const sourceName = params.get("from");
1116
const destinationName = params.get("to");
1217

1318
return (
14-
<TheaProvider
19+
<TheaLayout
1520
initialAssetTicker={assetTicker}
1621
initialSourceName={sourceName}
1722
initialDestinationName={destinationName}
1823
>
1924
{children}
20-
</TheaProvider>
25+
</TheaLayout>
2126
);
2227
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"use client";
2+
3+
import { TheaProvider } from "@orderbook/core/providers";
4+
import { ReactNode } from "react";
5+
6+
export function TheaLayout({
7+
children,
8+
initialAssetTicker,
9+
initialSourceName,
10+
initialDestinationName,
11+
}: {
12+
children: ReactNode;
13+
initialAssetTicker: string | null;
14+
initialSourceName: string | null;
15+
initialDestinationName: string | null;
16+
}) {
17+
return (
18+
<TheaProvider
19+
initialAssetTicker={initialAssetTicker}
20+
initialSourceName={initialSourceName}
21+
initialDestinationName={initialDestinationName}
22+
>
23+
{children}
24+
</TheaProvider>
25+
);
26+
}

0 commit comments

Comments
 (0)