diff --git a/packages/neos-ui-sagas/src/CR/Policies/index.js b/packages/neos-ui-sagas/src/CR/Policies/index.js index 9afcb69118..8d80a830ec 100644 --- a/packages/neos-ui-sagas/src/CR/Policies/index.js +++ b/packages/neos-ui-sagas/src/CR/Policies/index.js @@ -1,4 +1,4 @@ -import {select, take, put, fork} from 'redux-saga/effects'; +import {select, take, put, fork, takeLatest} from 'redux-saga/effects'; import {actions, actionTypes, selectors} from '@neos-project/neos-ui-redux-store'; import backend from '@neos-project/neos-ui-backend-connector'; @@ -22,8 +22,7 @@ function * fetchAdditionalNodeMetadata(nodesWithoutAdditionalMetadata) { } export function * watchNodeInformationChanges() { - while (true) { - const action = yield take([actionTypes.CR.Nodes.MERGE, actionTypes.CR.Nodes.ADD, actionTypes.CR.Nodes.SET_STATE]); + yield takeLatest([actionTypes.CR.Nodes.MERGE, actionTypes.CR.Nodes.ADD, actionTypes.CR.Nodes.SET_STATE], function * (action) { const nodeMap = (action.type === actionTypes.CR.Nodes.SET_STATE) ? action.payload.nodes : action.payload.nodeMap; const state = yield select(); @@ -39,10 +38,10 @@ export function * watchNodeInformationChanges() { }); if (nodesWithoutAdditionalMetadata.length === 0) { - continue; + return; } yield fork(fetchAdditionalNodeMetadata, nodesWithoutAdditionalMetadata); - } + }); }