Skip to content

Commit

Permalink
Comebined other if statements
Browse files Browse the repository at this point in the history
  • Loading branch information
WellHiIGuess committed Apr 5, 2024
1 parent 0a5882b commit c386e27
Showing 1 changed file with 17 additions and 22 deletions.
39 changes: 17 additions & 22 deletions packages/react-refresh/src/ReactFreshRuntime.js
Expand Up @@ -128,13 +128,12 @@ function haveEqualSignatures(prevType: any, nextType: any) {
if (prevSignature === undefined && nextSignature === undefined) {
return true;
}
if (prevSignature === undefined || nextSignature === undefined) {
return false;
}
if (computeFullKey(prevSignature) !== computeFullKey(nextSignature)) {
return false;
}
if (nextSignature.forceReset) {
if (
prevSignature === undefined ||
nextSignature === undefined ||
computeFullKey(prevSignature) !== computeFullKey(nextSignature) ||
nextSignature.forceReset
) {
return false;
}

Expand Down Expand Up @@ -252,10 +251,7 @@ export function performReactRefresh(): RefreshUpdate | null {
if (!failedRoots.has(root)) {
// No longer failed.
}
if (rootElements === null) {
return;
}
if (!rootElements.has(root)) {
if (rootElements === null || !rootElements.has(root)) {
return;
}
const element = rootElements.get(root);
Expand Down Expand Up @@ -300,10 +296,10 @@ export function performReactRefresh(): RefreshUpdate | null {

export function register(type: any, id: string): void {
if (__DEV__) {
if (type === null) {
return;
}
if (typeof type !== 'function' && typeof type !== 'object') {
if (
type === null ||
(typeof type !== 'function' && typeof type !== 'object')
) {
return;
}

Expand Down Expand Up @@ -695,13 +691,12 @@ export function isLikelyComponentType(type: any): boolean {
return true;
}
const ownNames = Object.getOwnPropertyNames(type.prototype);
if (ownNames.length > 1 || ownNames[0] !== 'constructor') {
// This looks like a class.
return false;
}
// eslint-disable-next-line no-proto
if (type.prototype.__proto__ !== Object.prototype) {
// It has a superclass.
if (
ownNames.length > 1 ||
ownNames[0] !== 'constructor' ||
type.prototype.__proto__ !== Object.prototype
) {
// This looks like a class or it has a superclass.
return false;
}
// Pass through.
Expand Down

0 comments on commit c386e27

Please sign in to comment.