From 0caff1a404c28221b9a6a7dea64201e8b51c2c89 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 18 Jun 2024 13:53:51 +0100 Subject: [PATCH] Fixing an issue with sorting in SQS. --- packages/server/src/sdk/app/rows/search/sqs.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/server/src/sdk/app/rows/search/sqs.ts b/packages/server/src/sdk/app/rows/search/sqs.ts index 64dd240f1c..684e4bd9a6 100644 --- a/packages/server/src/sdk/app/rows/search/sqs.ts +++ b/packages/server/src/sdk/app/rows/search/sqs.ts @@ -95,6 +95,8 @@ function buildTableMap(tables: Table[]) { // update the table name, should never query by name for SQLite table.originalName = table.name table.name = table._id! + // need a primary for sorting, lookups etc + table.primary = ["_id"] tableMap[table._id!] = table } return tableMap @@ -153,6 +155,10 @@ export async function search( const allTables = await sdk.tables.getAllInternalTables() const allTablesMap = buildTableMap(allTables) + // make sure we have the mapped/latest table + if (table?._id) { + table = allTablesMap[table?._id] + } if (!table) { throw new Error("Unable to find table") }