Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions apps/roam/src/utils/getRelationData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import fireQuery from "./fireQuery";
import getDiscourseNodes from "./getDiscourseNodes";
import getDiscourseRelations from "./getDiscourseRelations";
import type { DiscourseRelation } from "./getDiscourseRelations";
import internalError from "./internalError";

// lifted from getExportTypes

Expand Down Expand Up @@ -39,14 +40,23 @@ export const getRelationDataUtil = async (
label: "target",
},
],
}).then((results) =>
results.map((result) => ({
source: result.uid,
target: result["target-uid"],
relUid: s.id,
label: s.label,
})),
);
})
.then((results) =>
results.map((result) => ({
source: result.uid,
target: result["target-uid"],
relUid: s.id,
label: s.label,
})),
)
.catch((error) => {
internalError({
error,
type: "Get relation data",
userMessage: `Could not find relations of type ${s.label}`,
});
return [];
});
}),
).then((r) => r.flat());

Expand Down