-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
🪟 🐛 Fix validation when setting the connection stream cursor or primary key #18933
Conversation
Move changedStreams from CatalogTreeBody to CatalogTree so that the order of the changedStreams is based on the correct order
.sort(naturalComparatorBy((syncStream) => syncStream.stream?.name ?? "")), | ||
connection.syncCatalog.streams | ||
.filter((s) => s.config?.selected) | ||
.sort(naturalComparatorBy((syncStream) => syncStream.stream?.name ?? "")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand why these no longer need the sort. The only place I see us sorting now is the catalogTree. Isn't there still a chance that the order is not preserved between the connection object and the form values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason why this was sorted in the first place was that the formValues data was getting mutated by the sort call in the CatalogTree component. The formValues now contain same stream order as received in the connection object, and the order should match.
Tested locally and the bug does seem to be gone. Just one question to make sure we're covering all our bases! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested locally and problem is resolved, code looks good.
What
Related to https://github.com/airbytehq/oncall/issues/948
This fixes an issue related to validation not running when the connection stream primary key or cursor field is not set.
How
The validation was happening in the wrong order because the form initial values streams were being sorted when the CatalogTree component rendered. Instead, now it makes a copy of the array before sorting since sorting is one of those weird functions that is done in place.