Skip to content

Commit e293196

Browse files
NicolappsConvex, Inc.
authored andcommitted
dash: Fix the indexes pane state for tables being added to the schema (#41611)
GitOrigin-RevId: 3f54b431aa596528bcee6fcd743de80462ff9b9c
1 parent 405bfd5 commit e293196

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

npm-packages/dashboard-common/src/features/data/components/DataToolbar/DataToolbar.test.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ describe("DataToolbar", () => {
127127
tableSchemaStatus={{
128128
tableName,
129129
isDefined: false,
130+
isDefinedInInProgressSchema: false,
130131
referencedByTable: undefined,
131132
isValidationRunning: false,
132133
}}
@@ -420,6 +421,7 @@ describe("DataToolbar", () => {
420421
tableSchemaStatus: {
421422
tableName: "messages",
422423
isDefined: false,
424+
isDefinedInInProgressSchema: false,
423425
isValidationRunning: true,
424426
referencedByTable: undefined,
425427
},
@@ -435,6 +437,7 @@ describe("DataToolbar", () => {
435437
tableSchemaStatus: {
436438
tableName: "messages",
437439
isDefined: true,
440+
isDefinedInInProgressSchema: false,
438441
isValidationRunning: false,
439442
referencedByTable: undefined,
440443
},
@@ -450,6 +453,7 @@ describe("DataToolbar", () => {
450453
tableSchemaStatus: {
451454
tableName: "messages",
452455
isDefined: false,
456+
isDefinedInInProgressSchema: false,
453457
isValidationRunning: false,
454458
referencedByTable: "users",
455459
},
@@ -468,6 +472,7 @@ describe("DataToolbar", () => {
468472
tableSchemaStatus: {
469473
tableName: "messages",
470474
isDefined: false,
475+
isDefinedInInProgressSchema: false,
471476
isValidationRunning: false,
472477
referencedByTable: undefined,
473478
},
@@ -502,6 +507,7 @@ describe("DataToolbar", () => {
502507
tableSchemaStatus: {
503508
tableName: "messages",
504509
isDefined: false,
510+
isDefinedInInProgressSchema: false,
505511
isValidationRunning: false,
506512
referencedByTable: undefined,
507513
},

npm-packages/dashboard-common/src/features/data/components/TableIndexesPanel.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ function IndexBody({ tableName }: { tableName: string }) {
3434

3535
return (
3636
<div className="grow p-4 pt-0 sm:p-6">
37-
{tableSchemaStatus.isDefined ? (
37+
{tableSchemaStatus.isDefined ||
38+
tableSchemaStatus.isDefinedInInProgressSchema ? (
3839
<IndexList tableName={tableName} />
3940
) : (
4041
<>

npm-packages/dashboard-common/src/features/data/components/TableSchema.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { ShowSchema } from "@common/features/data/components/ShowSchema";
1212
export interface TableSchemaStatus {
1313
tableName: string;
1414
isDefined: boolean;
15+
isDefinedInInProgressSchema: boolean;
1516
referencedByTable: string | undefined;
1617
isValidationRunning: boolean;
1718
}
@@ -95,11 +96,23 @@ export function useSingleTableSchemaStatus(
9596
};
9697
}, [schemas?.active, tableName]);
9798

99+
const isDefinedInInProgressSchema = useMemo(() => {
100+
const inProgress: Schema | undefined = schemas?.inProgress
101+
? JSON.parse(schemas.inProgress)
102+
: undefined;
103+
104+
return (
105+
inProgress?.tables.find((table) => table.tableName === tableName) !==
106+
undefined
107+
);
108+
}, [schemas?.inProgress, tableName]);
109+
98110
const isValidationRunning = schemas?.inProgress !== undefined;
99111
return schemas
100112
? {
101113
tableName,
102114
isDefined,
115+
isDefinedInInProgressSchema,
103116
referencedByTable,
104117
isValidationRunning,
105118
}

0 commit comments

Comments
 (0)