🪟🐛 Connector form: Show success message right away #20354
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
This PR is fixing a little visual bug when submitting an unsaved connector form. When doing so, the loading bar would be shown while the connection test is running. If the test succeeds, the UI reverts back to the submit button for a short amount of time before changing again to the "connection test succeeded" message:
Kapture.2022-12-12.at.11.25.31.mp4
After this change, it behaves like a user would expect: loading -> success -> navigate away:
Kapture.2022-12-12.at.11.30.58.mp4
How
This behavior was caused by the fact that the connection success message is only shown if the "hasSuccess" flag passed down from the page component rendering the form is truthy. However, this flag is not about the connection test, but the success of the request actually saving the connection.
As this is not really related to each other (and doesn't matter for the user), I removed this prop being passed down and only check whether the connection test succeeded.
As a side note: We don't catch errors happening when creating a new source or destination which means they are caught by the default error boundary. This is a bad behavior because it means that the data provided by the user gets lost. I will open a separate issue for this.