Skip to content

Commit 2859952

Browse files
Fix rows order in relationsheep table compare (#10479)
* Remove mail URL from export pod Signed-off-by: Artem Savchenko <armisav@gmail.com> * Fix rows order in relationsheep table compare Signed-off-by: Artem Savchenko <armisav@gmail.com> --------- Signed-off-by: Artem Savchenko <armisav@gmail.com>
1 parent a59c5d0 commit 2859952

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

plugins/converter-resources/src/data/relationshipBuilder.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ export async function rebuildRelationshipTableViewModel (
4242
const docIds = docs.map((d) => d._id)
4343
const query = { _id: { $in: docIds } }
4444
docsWithAssociations = await client.findAll(cardClass, query, { lookup, associations })
45+
// Preserve order of input docs (findAll does not guarantee order)
46+
const idToIndex = new Map(docs.map((d, i) => [d._id, i]))
47+
docsWithAssociations.sort((a, b) => (idToIndex.get(a._id) ?? Infinity) - (idToIndex.get(b._id) ?? Infinity))
4548
}
4649

4750
for (const parentDoc of docsWithAssociations) {

0 commit comments

Comments
 (0)