From 42cbca0202852182a20e3f74a0e3f84aec3fe606 Mon Sep 17 00:00:00 2001 From: clickin Date: Thu, 30 Jul 2026 11:44:29 +0900 Subject: [PATCH] fix(react): guard against undefined 48357typeof in check() The check() function assumes Component['48357typeof'] is always defined when typeof Component === 'object', but non-React component objects (e.g. Svelte components imported via barrel) may not have 48357typeof. Calling .toString() on undefined throws TypeError. Add a null guard so the check returns false for non-React components instead of crashing. --- packages/integrations/react/src/server.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/integrations/react/src/server.ts b/packages/integrations/react/src/server.ts index 7da3c4535c93..4ba4cf9cd6eb 100644 --- a/packages/integrations/react/src/server.ts +++ b/packages/integrations/react/src/server.ts @@ -23,7 +23,8 @@ async function check( // Note: there are packages that do some unholy things to create "components". // Checking the $$typeof property catches most of these patterns. if (typeof Component === 'object') { - return Component['$$typeof'].toString().slice('Symbol('.length).startsWith('react'); + const $$typeof = Component['$$typeof']; + return $$typeof != null && $$typeof.toString().slice('Symbol('.length).startsWith('react'); } if (typeof Component !== 'function') return false; if (Component.name === 'QwikComponent') return false;