Skip to content

Commit ed7d870

Browse files
committed
cleanup
1 parent 2600829 commit ed7d870

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

packages/common/refresh-runtime.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,10 @@ function isPlainObject(obj) {
556556
)
557557
}
558558

559+
function isLikelyCompoundComponent(type) {
560+
return isPlainObject(type) && Object.keys(type).every(isLikelyComponentType)
561+
}
562+
559563
/**
560564
* Plugin utils
561565
*/
@@ -576,15 +580,7 @@ export function registerExportsForReactRefresh(filename, moduleExports) {
576580
// The register function has an identity check to not register twice the same component,
577581
// so this is safe to not used the same key here.
578582
register(exportValue, filename + ' export ' + key)
579-
}
580-
// If it's a compound component (plain object with component properties),
581-
// also register the individual components
582-
else if (
583-
isPlainObject(exportValue) &&
584-
Object.keys(exportValue).every((subKey) =>
585-
isLikelyComponentType(exportValue[subKey]),
586-
)
587-
) {
583+
} else if (isLikelyCompoundComponent(exportValue)) {
588584
for (const subKey in exportValue) {
589585
register(
590586
exportValue[subKey],

0 commit comments

Comments
 (0)