diff --git a/apps/desktop/src/components/diff/SchemaDiffConfigStep.vue b/apps/desktop/src/components/diff/SchemaDiffConfigStep.vue index 23bb3dae99..6946109c2d 100644 --- a/apps/desktop/src/components/diff/SchemaDiffConfigStep.vue +++ b/apps/desktop/src/components/diff/SchemaDiffConfigStep.vue @@ -105,6 +105,15 @@ function handleUpdateSelectedTables(value: string[]) { if (restrictTables.value) emit("update:selectedTables", [...value]); } +function clearUnavailableTableSelection() { + sourceTableList.value = []; + targetTableList.value = []; + if (props.selectedTables === undefined && !restrictTables.value && localSelectedTables.value.length === 0) return; + restrictTables.value = false; + localSelectedTables.value = []; + emit("update:selectedTables", undefined); +} + function getTableIdentity(side: SchemaDiffTableSide): SchemaDiffTableIdentity { return side === "source" ? { connectionId: props.sourceConnectionId, database: props.sourceDatabase, schema: props.sourceSchema } : { connectionId: props.targetConnectionId, database: props.targetDatabase, schema: props.targetSchema }; } @@ -277,13 +286,17 @@ watch( selectedTables: props.selectedTables, }), (current, previous) => { + if (!isTableIdentityReady("source")) { + clearUnavailableTableSelection(); + return; + } + if (!previous) return; if (current.source.every((value, index) => value === previous.source[index])) return; if (current.selectedTables !== previous.selectedTables) return; if (current.selectedTables === undefined && !restrictTables.value) return; - restrictTables.value = false; - localSelectedTables.value = []; - emit("update:selectedTables", undefined); + clearUnavailableTableSelection(); }, + { immediate: true }, ); watch( @@ -446,7 +459,15 @@ async function fetchDbVersion(connectionId: string, database: string, schema: st