Skip to content

Commit

Permalink
Additional fixes to getComponentsFromDefs
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Dec 5, 2024
1 parent b833ae9 commit 6fd54ae
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/core/src/dom_components/model/Components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,20 @@ const getComponentsFromDefs = (
}
}

// Here `result` might be a Component
const cmp = isFunction(result.components) ? (result as unknown as Component) : null;

if (components) {
const newComponents = getComponentsFromDefs(components, all, opts);

if (isFunction(result.components)) {
const cmps = result.components();
cmps.length > 0 && cmps.reset(newComponents, opts);
if (cmp) {
cmp.components().reset(newComponents, opts);
} else {
result.components = newComponents;
}
} else if (cmp) {
// The component already exists but the parsed one is without components
cmp.components().reset([], opts);
}

return result;
Expand Down

0 comments on commit 6fd54ae

Please sign in to comment.