This commit is contained in:
Adria Navarro 2024-08-28 18:08:07 +02:00
parent de29d31c35
commit 73ec0bbf09
3 changed files with 5 additions and 11 deletions

View File

@ -154,9 +154,6 @@ export async function finaliseRow(
if (updateFormula) {
await updateRelatedFormula(table, enrichedRow)
}
const squashed = await linkRows.squashLinksToPrimaryDisplay(
table,
enrichedRow
)
const squashed = await linkRows.squashLinks(table, enrichedRow)
return { row: enrichedRow, squashed, table }
}

View File

@ -247,10 +247,10 @@ function getPrimaryDisplayValue(row: Row, table?: Table) {
* @param enriched The pre-enriched rows (full docs) which are to be squashed.
* @returns The rows after having their links squashed to only contain the ID and primary display.
*/
export async function squashLinksToPrimaryDisplay(
export async function squashLinks<T = Row[] | Row>(
table: Table,
enriched: Row[] | Row
) {
enriched: T
): Promise<T> {
// will populate this as we find them
const linkedTables = [table]
const isArray = Array.isArray(enriched)

View File

@ -343,10 +343,7 @@ export async function outputProcessing<T extends Row[] | Row>(
enriched = await processFormulas(table, enriched, { dynamic: true })
if (opts.squash) {
enriched = (await linkRows.squashLinksToPrimaryDisplay(
table,
enriched
)) as Row[]
enriched = await linkRows.squashLinks(table, enriched)
}
// remove null properties to match internal API
const isExternal = isExternalTableID(table._id!)