Skip to content

Commit

Permalink
refactor(theme-common): change storageUtils useSyncExternalCode getSn…
Browse files Browse the repository at this point in the history
…apshot workaround (#10728)
  • Loading branch information
slorber authored Nov 29, 2024
1 parent 8098741 commit 750edc7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/docusaurus-theme-common/src/utils/storageUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ export function useStorageSlot(
const currentValue = useSyncExternalStore(
listen,
() => {
// TODO this check should be useless after React 18
if (typeof window === 'undefined') {
// react-test-renderer (deprecated) never call getServerSnapshot() :/
if (process.env.NODE_ENV === 'test') {
return null;
}
return storageSlot.get();
Expand Down

0 comments on commit 750edc7

Please sign in to comment.