diff --git a/src/plugins/data-card/data-card-tile.tsx b/src/plugins/data-card/data-card-tile.tsx index 9d63c3cc3..da1697ab2 100644 --- a/src/plugins/data-card/data-card-tile.tsx +++ b/src/plugins/data-card/data-card-tile.tsx @@ -53,6 +53,10 @@ export const DataCardToolComponent: React.FC = observer(function Dat const selectedCaseId = dataSet.firstSelectedCaseId !== undefined ? dataSet.firstSelectedCaseId : dataSet.firstSelectedCell?.caseId; useEffect(() => { + // caseIndex is undefined when the tile is first created. + // The initial setting of this field must be handled `updateAfterSharedModelChanges`, + // so that it is part of the same history entry as the tile creation. Setting it here would mean + // creating a second history entry that might be out of order. if (content.caseIndex === undefined) return; if (selectedCaseId !== undefined && dataSet.caseIndexFromID(selectedCaseId) !== content.caseIndex) { content.setCaseIndex(dataSet.caseIndexFromID(selectedCaseId));