Skip to content

Commit 93ad483

Browse files
committed
Remove Navigator TS declaration override
1 parent 034c0ef commit 93ad483

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

.changeset/odd-tools-work.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-router": patch
3+
---
4+
5+
Remove `Navigator` declaration for `navigator.connection.saveData` to avoid messing with any other types beyond `saveData` in userland

packages/react-router/lib/dom/ssr/fog-of-war.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ import type { EntryRoute } from "./routes";
99
import { createClientRoutes } from "./routes";
1010
import type { ServerBuild } from "../../server-runtime/build";
1111

12-
declare global {
13-
interface Navigator {
14-
connection?: { saveData: boolean };
15-
}
16-
}
17-
1812
// Currently rendered links that may need prefetching
1913
const nextPaths = new Set<string>();
2014

@@ -115,7 +109,8 @@ export function useFogOFWarDiscovery(
115109
// Don't prefetch if not enabled or if the user has `saveData` enabled
116110
if (
117111
!isFogOfWarEnabled(routeDiscovery, ssr) ||
118-
navigator.connection?.saveData === true
112+
// @ts-expect-error - TS doesn't know about this yet
113+
window.navigator?.connection?.saveData === true
119114
) {
120115
return;
121116
}

0 commit comments

Comments
 (0)