Skip to content

Commit

Permalink
more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
snewcomer committed Dec 3, 2020
1 parent 9e1ce7a commit 991e96f
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions packages/store/addon/-private/system/record-array-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,28 +418,15 @@ const updateLiveRecordArray = function updateLiveRecordArray(store, recordArray,
}

if (identifiersToAdd.length > 0) {
pushIdentifiers(recordArray, identifiersToAdd, internalModelFactoryFor(store));
recordArray._pushIdentifiers(identifiersToAdd);
}
if (identifiersToRemove.length > 0) {
removeIdentifiers(recordArray, identifiersToRemove, internalModelFactoryFor(store));
removeIdentifiers(recordArray, identifiersToRemove);
}
};

const pushIdentifiers = function pushIdentifiers(recordArray, identifiers, cache) {
if (!REMOVE_RECORD_ARRAY_MANAGER_LEGACY_COMPAT && !recordArray._pushIdentifiers) {
// deprecate('not allowed to use this intimate api any more');
recordArray._pushInternalModels(identifiers.map(i => peekIMCache(cache, i)));
} else {
recordArray._pushIdentifiers(identifiers);
}
};
const removeIdentifiers = function removeIdentifiers(recordArray, identifiers, cache) {
if (!REMOVE_RECORD_ARRAY_MANAGER_LEGACY_COMPAT && !recordArray._removeIdentifiers) {
// deprecate('not allowed to use this intimate api any more');
recordArray._removeInternalModels(identifiers.map(i => peekIMCache(cache, i)));
} else {
recordArray._removeIdentifiers(identifiers);
}
const removeIdentifiers = function removeIdentifiers(recordArray, identifiers) {
recordArray._removeIdentifiers(identifiers);
};

const removeFromAdapterPopulatedRecordArrays = function removeFromAdapterPopulatedRecordArrays(store, identifiers) {
Expand All @@ -451,10 +438,9 @@ const removeFromAdapterPopulatedRecordArrays = function removeFromAdapterPopulat
const removeFromAll = function removeFromAll(store, identifier) {
identifier = getIdentifier(identifier);
const recordArrays = recordArraysForIdentifier(identifier);
const cache = internalModelFactoryFor(store);

recordArrays.forEach(function(recordArray) {
removeIdentifiers(recordArray, [identifier], cache);
removeIdentifiers(recordArray, [identifier]);
});

recordArrays.clear();
Expand Down

0 comments on commit 991e96f

Please sign in to comment.