Skip to content

Commit faff98d

Browse files
committed
chore: replace window with globalThis
1 parent 5ca1298 commit faff98d

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

apps/insights/src/components/PriceComponentDrawer/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ const getScoreHistory = async ([
337337
symbol,
338338
selectedPeriod,
339339
]: [Cluster, string, string, EvaluationPeriod]) => {
340-
const url = new URL("/component-score-history", window.location.origin);
340+
const url = new URL("/component-score-history", globalThis.location.origin);
341341
url.searchParams.set("cluster", ClusterToName[cluster]);
342342
url.searchParams.set("publisherKey", publisherKey);
343343
url.searchParams.set("symbol", symbol);

apps/insights/src/components/PriceFeed/chart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const useChartElem = (symbol: string, feedId: string) => {
4444
const backfillData = useCallback(() => {
4545
if (!isBackfilling.current && earliestDateRef.current) {
4646
isBackfilling.current = true;
47-
const url = new URL("/historical-prices", window.location.origin);
47+
const url = new URL("/historical-prices", globalThis.location.origin);
4848
url.searchParams.set("symbol", symbol);
4949
url.searchParams.set("until", earliestDateRef.current.toString());
5050
fetch(url)

apps/insights/src/components/PriceFeedChangePercent/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const YesterdaysPricesProvider = ({
4343
const getYesterdaysPrices = async (
4444
feeds: YesterdaysPricesProviderProps["feeds"],
4545
): Promise<Map<string, number>> => {
46-
const url = new URL("/yesterdays-prices", window.location.origin);
46+
const url = new URL("/yesterdays-prices", globalThis.location.origin);
4747
for (const symbol of Object.keys(feeds)) {
4848
url.searchParams.append("symbols", symbol);
4949
}

apps/insights/src/components/Root/search-dialog.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,9 @@ const useSearchDialogStateContext = () => {
434434
);
435435

436436
useEffect(() => {
437-
window.addEventListener("keydown", handleKeyDown);
437+
globalThis.addEventListener("keydown", handleKeyDown);
438438
return () => {
439-
window.removeEventListener("keydown", handleKeyDown);
439+
globalThis.removeEventListener("keydown", handleKeyDown);
440440
};
441441
}, [handleKeyDown]);
442442

apps/staking/src/components/Root/i18n-provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const I18nProvider = (
1616
() =>
1717
isSSR
1818
? DEFAULT_LOCALE
19-
: (window.navigator.languages.find((locale) => {
19+
: (globalThis.navigator.languages.find((locale) => {
2020
const language = parse(locale).language;
2121
return (
2222
language !== undefined &&

packages/next-root/src/i18n-provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const I18nProvider = (
1616
() =>
1717
isSSR
1818
? DEFAULT_LOCALE
19-
: (window.navigator.languages.find((locale) => {
19+
: (globalThis.navigator.languages.find((locale) => {
2020
const language = parse(locale).language;
2121
return (
2222
language !== undefined &&

0 commit comments

Comments
 (0)