Connecting a database no longer freezes the page: the columns field keeps one empty list
This commit is contained in:
@@ -33,6 +33,8 @@ export interface SourceDialogData {
|
||||
guided?: Guided | null;
|
||||
label?: string;
|
||||
}
|
||||
const NONE: string[] = [];
|
||||
|
||||
/** What it gives back: the dialog's answers (the node's dlt fields are made from them). */
|
||||
export interface SourceDialogResult {
|
||||
guided: Guided;
|
||||
@@ -203,17 +205,17 @@ export class SourceDialog {
|
||||
}
|
||||
}
|
||||
|
||||
/** The tables a database listed, for its table field. */
|
||||
/** A list answer (the columns picked), as a list. */
|
||||
protected listed(name: string): string[] {
|
||||
const v = this.value(name);
|
||||
return Array.isArray(v) ? (v as string[]) : [];
|
||||
return Array.isArray(v) ? (v as string[]) : NONE; // a new list each time renders forever
|
||||
}
|
||||
/** The columns to pick from: the first rows', and those already picked. */
|
||||
protected columnOptions(name: string): string[] {
|
||||
return [...new Set([...this.columns(), ...this.listed(name)])];
|
||||
}
|
||||
|
||||
/** The tables a database listed, for its table field. */
|
||||
protected tables(): string[] {
|
||||
return this.tableList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user