Skip to content

Commit

Permalink
Be defensive against non-components being passed to setSignature
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Mar 30, 2021
1 parent 070262b commit 8ffb8cd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/react-refresh/src/ReactFreshRuntime.js
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,12 @@ export function createSignatureFunctionForTransform() {
// Set the signature for all types (even wrappers!) in case
// they have no signatures of their own. This is to prevent
// problems like https://github.com/facebook/react/issues/20417.
setSignature(type, key, forceReset, getCustomHooks);
if (
type != null &&
(typeof type === 'function' || typeof type === 'object')
) {
setSignature(type, key, forceReset, getCustomHooks);
}
return type;
} else {
// We're in the _s() call without arguments, which means
Expand Down

0 comments on commit 8ffb8cd

Please sign in to comment.