Skip to content

Commit f0bb7a0

Browse files
author
Tim Roes
authored
Fix showing reset dialog after refresh source (#19350)
1 parent 0af08f6 commit f0bb7a0

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/ConnectionReplicationTab.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,24 @@ export const ConnectionReplicationTab: React.FC = () => {
8686
connection.operations
8787
);
8888

89-
// Detect whether the catalog has any differences in its enabled streams compared to the original one.
90-
// This could be due to user changes (e.g. in the sync mode) or due to new/removed
91-
// streams due to a "refreshed source schema".
92-
const catalogHasChanged = !equal(
89+
// Check if the user refreshed the catalog and there was any change in a currently enabled stream
90+
const hasDiffInEnabledStream = connection.catalogDiff?.transforms.some(({ streamDescriptor }) => {
91+
// Find the stream for this transform in our form's syncCatalog
92+
const stream = formValues.syncCatalog.streams.find(
93+
({ stream }) => streamDescriptor.name === stream?.name && streamDescriptor.namespace === stream.namespace
94+
);
95+
return stream?.config?.selected;
96+
});
97+
98+
// Check if the user made any modifications to enabled streams compared to the ones in the latest connection
99+
// e.g. changed the sync mode of an enabled stream
100+
const hasUserChangesInEnabledStreams = !equal(
93101
formValues.syncCatalog.streams.filter((s) => s.config?.selected),
94102
connection.syncCatalog.streams.filter((s) => s.config?.selected)
95103
);
96104

105+
const catalogHasChanged = hasDiffInEnabledStream || hasUserChangesInEnabledStreams;
106+
97107
setSubmitError(null);
98108

99109
// Whenever the catalog changed show a warning to the user, that we're about to reset their data.
@@ -131,6 +141,7 @@ export const ConnectionReplicationTab: React.FC = () => {
131141
},
132142
[
133143
connection.connectionId,
144+
connection.catalogDiff,
134145
connection.operations,
135146
connection.status,
136147
connection.syncCatalog.streams,

0 commit comments

Comments
 (0)