Merge pull request #15140 from Budibase/datasource-sorting-fix

handle cases where datasourceName is undefined when sorting datasources
This commit is contained in:
Andrew Thompson 2024-12-09 10:36:46 +00:00 committed by GitHub
commit d725d49dbf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -56,7 +56,10 @@
.map(table => format.table(table, $datasources.list))
.sort((a, b) => {
// sort tables alphabetically, grouped by datasource
const dsComparison = a.datasourceName.localeCompare(b.datasourceName)
const dsA = a.datasourceName ?? ""
const dsB = b.datasourceName ?? ""
const dsComparison = dsA.localeCompare(dsB)
if (dsComparison !== 0) {
return dsComparison
}