refactor(theme-common): change storageUtils useSyncExternalCode getSnapshot workaround (#10728)

This commit is contained in:
Sébastien Lorber 2024-11-29 16:50:10 +01:00 committed by GitHub
parent 8098741245
commit 750edc78ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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();