Fixing an issue raised by Poirazis around empty relationships coming back as related to themselves.

This commit is contained in:
mike12345567 2024-06-21 19:29:30 +01:00
parent 337584f5b2
commit fcf67f7297
2 changed files with 11 additions and 4 deletions

View File

@ -99,7 +99,7 @@ export function basicProcessing({
row, row,
tableName: table._id!, tableName: table._id!,
fieldName: internalColumn, fieldName: internalColumn,
isLinked: false, isLinked,
}) })
} }
} }

View File

@ -1950,10 +1950,7 @@ describe.each([
}) })
}) })
// This will never work for Lucene.
!isLucene && !isLucene &&
// It also can't work for in-memory searching because the related table name
// isn't available.
!isInMemory && !isInMemory &&
describe("relations", () => { describe("relations", () => {
let productCategoryTable: Table, productCatRows: Row[] let productCategoryTable: Table, productCatRows: Row[]
@ -1996,6 +1993,10 @@ describe.each([
name: "bar", name: "bar",
productCat: [productCatRows[1]._id], productCat: [productCatRows[1]._id],
}), }),
config.api.row.save(table._id!, {
name: "baz",
productCat: [],
}),
]) ])
}) })
@ -2014,6 +2015,12 @@ describe.each([
{ name: "foo", productCat: [{ _id: productCatRows[0]._id }] }, { name: "foo", productCat: [{ _id: productCatRows[0]._id }] },
]) ])
}) })
it("shouldn't return any relationship for last row", async () => {
await expectQuery({
equal: { ["name"]: "baz" },
}).toContainExactly([{ name: "baz", productCat: undefined }])
})
}) })
// lucene can't count the total rows // lucene can't count the total rows