Skip to content

🪟 🐛 Fix showing reset dialog after refresh source #19350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,24 @@ export const ConnectionReplicationTab: React.FC = () => {
connection.operations
);

// Detect whether the catalog has any differences in its enabled streams compared to the original one.
// This could be due to user changes (e.g. in the sync mode) or due to new/removed
// streams due to a "refreshed source schema".
const catalogHasChanged = !equal(
// Check if the user refreshed the catalog and there was any change in a currently enabled stream
const hasDiffInEnabledStream = connection.catalogDiff?.transforms.some(({ streamDescriptor }) => {
// Find the stream for this transform in our form's syncCatalog
const stream = formValues.syncCatalog.streams.find(
({ stream }) => streamDescriptor.name === stream?.name && streamDescriptor.namespace === stream.namespace
);
return stream?.config?.selected;
});

// Check if the user made any modifications to enabled streams compared to the ones in the latest connection
// e.g. changed the sync mode of an enabled stream
const hasUserChangesInEnabledStreams = !equal(
formValues.syncCatalog.streams.filter((s) => s.config?.selected),
connection.syncCatalog.streams.filter((s) => s.config?.selected)
);

const catalogHasChanged = hasDiffInEnabledStream || hasUserChangesInEnabledStreams;

setSubmitError(null);

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