Skip to content

Commit 750edc7

Browse files
authored
refactor(theme-common): change storageUtils useSyncExternalCode getSnapshot workaround (#10728)
1 parent 8098741 commit 750edc7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/docusaurus-theme-common/src/utils/storageUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ export function useStorageSlot(
229229
const currentValue = useSyncExternalStore(
230230
listen,
231231
() => {
232-
// TODO this check should be useless after React 18
233-
if (typeof window === 'undefined') {
232+
// react-test-renderer (deprecated) never call getServerSnapshot() :/
233+
if (process.env.NODE_ENV === 'test') {
234234
return null;
235235
}
236236
return storageSlot.get();

0 commit comments

Comments
 (0)