Fix for #9749 - static formulas would sometimes attempt to update the same row multiple times, filter down to just the unique row list which requires updating.
This commit is contained in:
parent
53f6b2b6e6
commit
1eb2307fed
|
@ -38,7 +38,13 @@ export async function updateRelatedFormula(
|
|||
if (!relatedRows[relatedTableId]) {
|
||||
relatedRows[relatedTableId] = []
|
||||
}
|
||||
relatedRows[relatedTableId] = relatedRows[relatedTableId].concat(field)
|
||||
// filter down to the rows which are not already included in related
|
||||
const currentIds = relatedRows[relatedTableId].map(row => row._id)
|
||||
const uniqueRelatedRows = field.filter(
|
||||
(row: Row) => !currentIds.includes(row._id)
|
||||
)
|
||||
relatedRows[relatedTableId] =
|
||||
relatedRows[relatedTableId].concat(uniqueRelatedRows)
|
||||
}
|
||||
}
|
||||
for (let tableId of table.relatedFormula) {
|
||||
|
|
Loading…
Reference in New Issue