Skip to content

Commit

Permalink
BUGFIX: Prevent incompletely loaded children on deeper levels
Browse files Browse the repository at this point in the history
Co-authored-by: Wilhelm Behncke <2522299+grebaldi@users.noreply.github.com>
  • Loading branch information
Sebobo and grebaldi authored Jul 30, 2021
1 parent f1c88c0 commit 3e3064b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions packages/neos-ui-sagas/src/UI/ContentTree/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,16 @@ export function * watchToggle({globalRegistry}) {
return;
}

const childrenAreFullyLoaded = children
.filter(childEnvelope => nodeTypesRegistry.hasRole(childEnvelope.nodeType, 'content') || nodeTypesRegistry.hasRole(childEnvelope.nodeType, 'contentCollection'))
.every(
childEnvelope => Boolean($get(['cr', 'nodes', 'byContextPath', $get('contextPath', childEnvelope)], state))
);
const checkIfChildrenAreFullyLoadedRecursively = contextPath => {
return $get(['cr', 'nodes', 'byContextPath', contextPath, 'children'], state)
.filter(childEnvelope => nodeTypesRegistry.hasRole(childEnvelope.nodeType, 'content') || nodeTypesRegistry.hasRole(childEnvelope.nodeType, 'contentCollection'))
.every(
childEnvelope =>
$get(['cr', 'nodes', 'byContextPath', $get('contextPath', childEnvelope)], state)
&& checkIfChildrenAreFullyLoadedRecursively($get('contextPath', childEnvelope))
);
}
const childrenAreFullyLoaded = checkIfChildrenAreFullyLoadedRecursively(contextPath);

if (!childrenAreFullyLoaded) {
yield put(actions.UI.ContentTree.requestChildren(contextPath));
Expand Down

0 comments on commit 3e3064b

Please sign in to comment.