-
Notifications
You must be signed in to change notification settings - Fork 130
/
Copy pathentry-client.tsx
29 lines (26 loc) · 1003 Bytes
/
entry-client.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// @refresh reload
import { debounce } from "@solid-primitives/scheduled";
import { mount, StartClient } from "@solidjs/start/client";
// import "solid-devtools";
// Primitives/Table.tsx produces a lot of hydration warnings in development mode.
if (import.meta.env.MODE === "development") {
const keys: string[] = [];
// eslint-disable-next-line no-console
const cw = console.warn;
// eslint-disable-next-line no-console
console.warn = (...args) => {
if (args[0] === "Unable to find DOM nodes for hydration key:") {
keys.push(args[1]);
logStoredWarnings();
} else cw(...args);
};
const logStoredWarnings = debounce(() => {
// eslint-disable-next-line no-console
console.groupCollapsed(`There were ${keys.length} hydration warnings.`);
keys.forEach(key => cw("Unable to find DOM nodes for hydration key:", key));
// eslint-disable-next-line no-console
console.groupEnd();
keys.length = 0;
}, 1000);
}
mount(() => <StartClient />, document);