@samitouri / QOS-React-2 / commits / 4e6eec69be

fix: document can be `null`, not just `undefined` (#22695)

Simen Bekkhus committed Nov 24, 2021 at 21:51 UTC 4e6eec69be632c0c0177c5b1c8a70397d92ee181
1 file changed +1 -1
packages/shared/invokeGuardedCallbackImpl.js
+1 -1
@@ -81,7 +81,7 @@ if (__DEV__) {
81 // when we call document.createEvent(). However this can cause confusing
82 // errors: https://github.com/facebook/create-react-app/issues/3482
83 // So we preemptively throw with a better message instead.
84 - if (typeof document === 'undefined') {
84 + if (typeof document === 'undefined' || document === null) {
85 throw new Error(
86 'The `document` global was defined when React was initialized, but is not ' +
87 'defined anymore. This can happen in a test environment if a component ' +