@samitouri / QOS-React / commits / 37bcdcde04

fix[devtools]: feature-check document with typeof instead of direct reference (#35343)

Follow-up to https://github.com/facebook/react/pull/35296. We can get `ReferenceError` if this is unavailable. Using `typeof` check instead for safety.

Ruslan Lesiutin committed Dec 11, 2025 at 12:15 UTC 37bcdcde044131d49f11b2f62873a200a94ec756
1 file changed +5 -2
packages/react-devtools-shared/src/backend/views/Highlighter/index.js
+5 -2
@@ -96,8 +96,11 @@ export default function setupHighlighter(
96 applyingScroll = false;
97 }
98
99 - // $FlowFixMe[method-unbinding]
100 - if (document && typeof document.addEventListener === 'function') {
99 + if (
100 + typeof document === 'object' &&
101 + // $FlowFixMe[method-unbinding]
102 + typeof document.addEventListener === 'function'
103 + ) {
104 document.addEventListener('scroll', () => {
105 if (!scrollTimer) {
106 // Periodically synchronize the scroll while scrolling.