Fix optimistic rendering when deleting multiple records (#9198)
Fixes https://discord.com/channels/1130383047699738754/1319676302944370730/1319676302944370730
This commit is contained in:
@ -75,14 +75,12 @@ export const triggerUpdateRecordOptimisticEffectByBatch = ({
|
||||
objectMetadataItem,
|
||||
});
|
||||
|
||||
const updatedRecordIndexInRootQueryEdges =
|
||||
rootQueryCurrentEdges.findIndex(
|
||||
const updatedRecordFoundInRootQueryEdges = isDefined(
|
||||
rootQueryCurrentEdges.find(
|
||||
(cachedEdge) =>
|
||||
readField('id', cachedEdge.node) === updatedRecord.id,
|
||||
);
|
||||
|
||||
const updatedRecordFoundInRootQueryEdges =
|
||||
updatedRecordIndexInRootQueryEdges > -1;
|
||||
),
|
||||
);
|
||||
|
||||
const updatedRecordShouldBeAddedToRootQueryEdges =
|
||||
updatedRecordMatchesThisRootQueryFilter &&
|
||||
@ -105,7 +103,10 @@ export const triggerUpdateRecordOptimisticEffectByBatch = ({
|
||||
}
|
||||
|
||||
if (updatedRecordShouldBeRemovedFromRootQueryEdges) {
|
||||
rootQueryNextEdges.splice(updatedRecordIndexInRootQueryEdges, 1);
|
||||
rootQueryNextEdges = rootQueryNextEdges.filter(
|
||||
(cachedEdge) =>
|
||||
readField('id', cachedEdge.node) !== updatedRecord.id,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user