Skip to content

Commit

Permalink
simplify component view executor
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrsh committed Apr 17, 2019
1 parent 78c0a58 commit b3caaf6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
7 changes: 3 additions & 4 deletions packages/moon/dist/moon.js
Original file line number Diff line number Diff line change
Expand Up @@ -709,13 +709,12 @@

if (node.type === types.component) {
// Execute the component to get the component view.
var nodeComponent = components[node.name](node.data); // TODO: Update component children and component output children.
// Set the root view or current node to the new component view.
node = components[node.name](node.data); // Set the root view or current node to the new component view.

if (parent === null) {
setViewNew(nodeComponent);
setViewNew(node);
} else {
node = parent.data.children[index] = nodeComponent;
parent.data.children[index] = node;
}
} else if (parent === null) {
// If there is no parent, set the root new view to the current node.
Expand Down
2 changes: 1 addition & 1 deletion packages/moon/dist/moon.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions packages/moon/src/executor/executor.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,13 @@ function executeView(nodes, parents, indexes) {

if (node.type === types.component) {
// Execute the component to get the component view.
const nodeComponent = components[node.name](node.data);

// TODO: Update component children and component output children.
node = components[node.name](node.data);

// Set the root view or current node to the new component view.
if (parent === null) {
setViewNew(nodeComponent);
setViewNew(node);
} else {
node = parent.data.children[index] = nodeComponent;
parent.data.children[index] = node;
}
} else if (parent === null) {
// If there is no parent, set the root new view to the current node.
Expand Down

0 comments on commit b3caaf6

Please sign in to comment.