Fixing an issue with sorting in SQS.
This commit is contained in:
parent
5c45370722
commit
0caff1a404
|
@ -95,6 +95,8 @@ function buildTableMap(tables: Table[]) {
|
||||||
// update the table name, should never query by name for SQLite
|
// update the table name, should never query by name for SQLite
|
||||||
table.originalName = table.name
|
table.originalName = table.name
|
||||||
table.name = table._id!
|
table.name = table._id!
|
||||||
|
// need a primary for sorting, lookups etc
|
||||||
|
table.primary = ["_id"]
|
||||||
tableMap[table._id!] = table
|
tableMap[table._id!] = table
|
||||||
}
|
}
|
||||||
return tableMap
|
return tableMap
|
||||||
|
@ -153,6 +155,10 @@ export async function search(
|
||||||
|
|
||||||
const allTables = await sdk.tables.getAllInternalTables()
|
const allTables = await sdk.tables.getAllInternalTables()
|
||||||
const allTablesMap = buildTableMap(allTables)
|
const allTablesMap = buildTableMap(allTables)
|
||||||
|
// make sure we have the mapped/latest table
|
||||||
|
if (table?._id) {
|
||||||
|
table = allTablesMap[table?._id]
|
||||||
|
}
|
||||||
if (!table) {
|
if (!table) {
|
||||||
throw new Error("Unable to find table")
|
throw new Error("Unable to find table")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue