mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-29 18:27:56 +02:00
refactor(theme-common): change storageUtils useSyncExternalCode getSnapshot workaround (#10728)
This commit is contained in:
parent
8098741245
commit
750edc78ff
1 changed files with 2 additions and 2 deletions
|
@ -229,8 +229,8 @@ export function useStorageSlot(
|
||||||
const currentValue = useSyncExternalStore(
|
const currentValue = useSyncExternalStore(
|
||||||
listen,
|
listen,
|
||||||
() => {
|
() => {
|
||||||
// TODO this check should be useless after React 18
|
// react-test-renderer (deprecated) never call getServerSnapshot() :/
|
||||||
if (typeof window === 'undefined') {
|
if (process.env.NODE_ENV === 'test') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return storageSlot.get();
|
return storageSlot.get();
|
||||||
|
|
Loading…
Add table
Reference in a new issue