fix(grid): keep hiding xugu __DBX_ROWID after metadata loads

This commit is contained in:
zipg authored and GitHub committed 2026-09-14 12:39:42 +08:00
1 parent 638aa48f57
commit ae1da14ddf
2 files changed
+11

No files matched your search

@@ -11,6 +11,7 @@ import {
editableRowIdentifierColumns,
hasCompleteTdengineRowIdentity,
isClickHouseExistingRowReadonlyColumn,
isHiddenGridColumn,
isTdengineExistingRowReadonlyColumn,
isTableDataEditable,
supportsDataGridTransaction,
@@ -72,6 +73,13 @@ describe("tableEditing", () => {
expect(shouldIncludeSyntheticRowId("oracle", [], "TABLE")).toBe(false);
});
it("keeps Xugu's internal ROWID hidden after primary-key metadata arrives", () => {
expect(isHiddenGridColumn("xugu", DBX_ROWID_COLUMN, ["ID"], "TABLE")).toBe(true);
expect(isHiddenGridColumn("xugu", DBX_ROWID_COLUMN, [], "TABLE")).toBe(true);
expect(isHiddenGridColumn("xugu", DBX_ROWID_COLUMN, ["ID"], "VIEW")).toBe(false);
expect(isHiddenGridColumn("xugu", "ID", ["ID"], "TABLE")).toBe(false);
});
it("treats view data tabs as readonly", () => {
expect(isTableDataEditable("oracle", [DBX_ROWID_COLUMN], "VIEW")).toBe(false);
});
@@ -117,6 +117,9 @@ export function shouldIncludeSyntheticRowId(databaseType: DatabaseType | undefin
export function isHiddenGridColumn(databaseType: DatabaseType | undefined, column: string, primaryKeys: string[], tableType?: string): boolean {
if (databaseType === "neo4j" && column === DBX_NEO4J_ELEMENT_ID_COLUMN) return true;
// Xugu may inject ROWID before table metadata finishes loading. Keep this
// internal projection hidden even after the real primary keys arrive.
if (databaseType === "xugu" && !isViewTableType(tableType) && column.toUpperCase() === DBX_ROWID_COLUMN) return true;
return shouldIncludeSyntheticRowId(databaseType, primaryKeys, tableType) && column.toUpperCase() === DBX_ROWID_COLUMN;
}