WikiTree: display marriage info for ancestors

This commit is contained in:
Przemek Wiech
2020-01-19 23:44:36 +01:00
parent 720c351254
commit 21451e4282

View File

@@ -100,10 +100,14 @@ export async function loadWikiTree(
// Fetch the ancestors of the input person and ancestors of his/her spouses.
const firstPerson = await getRelatives([key], handleCors);
const spouseKeys = Object.values(firstPerson[0].Spouses).map((s) => s.Name);
[key].concat(spouseKeys).forEach(async (personId) => {
const ancestors = await getAncestors(personId, handleCors);
everyone.push(...ancestors);
});
const ancestors = await Promise.all(
[key]
.concat(spouseKeys)
.map((personId) => getAncestors(personId, handleCors)),
);
const ancestorKeys = ancestors.flat().map((person) => person.Name);
const ancestorDetails = await getRelatives(ancestorKeys, handleCors);
everyone.push(...ancestorDetails);
// Fetch descendants recursively.
let toFetch = [key];