Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
removedRecords.forEach((record) => {
let recordIdentity = recordIdentityFrom(
store,
record.id,
toOrbitType(store, record.type)
);
// was this record already removed from the cache?
// maybe we are receiving an operations payload that is telling us
// to remove something that we've already removed.
let exists = false;
try {
exists = store.cache.query((q) => q.findRecord(recordIdentity));
} catch (e) {
// don't care if this throws an exception;
}
if (exists) {