@@ -86,14 +86,24 @@ export const ConnectionReplicationTab: React.FC = () => {
86
86
connection . operations
87
87
) ;
88
88
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 (
93
101
formValues . syncCatalog . streams . filter ( ( s ) => s . config ?. selected ) ,
94
102
connection . syncCatalog . streams . filter ( ( s ) => s . config ?. selected )
95
103
) ;
96
104
105
+ const catalogHasChanged = hasDiffInEnabledStream || hasUserChangesInEnabledStreams ;
106
+
97
107
setSubmitError ( null ) ;
98
108
99
109
// 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 = () => {
131
141
} ,
132
142
[
133
143
connection . connectionId ,
144
+ connection . catalogDiff ,
134
145
connection . operations ,
135
146
connection . status ,
136
147
connection . syncCatalog . streams ,
0 commit comments