Skip to content

Commit 4e6eec6

Browse files
authored
fix: document can be null, not just undefined (#22695)
1 parent c1220eb commit 4e6eec6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/shared/invokeGuardedCallbackImpl.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ if (__DEV__) {
8181
// when we call document.createEvent(). However this can cause confusing
8282
// errors: https://github.com/facebook/create-react-app/issues/3482
8383
// So we preemptively throw with a better message instead.
84-
if (typeof document === 'undefined') {
84+
if (typeof document === 'undefined' || document === null) {
8585
throw new Error(
8686
'The `document` global was defined when React was initialized, but is not ' +
8787
'defined anymore. This can happen in a test environment if a component ' +

0 commit comments

Comments
 (0)