From 5ad11671dbc16b460a19ef569659e570060e7b7d Mon Sep 17 00:00:00 2001 From: Boris Goldowsky Date: Fri, 20 Sep 2024 12:12:06 -0400 Subject: [PATCH] Add comment. --- src/plugins/data-card/data-card-tile.tsx | 4 ++++ 1 file changed, 4 insertions(+) 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));