Skip to content
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

🪟🔧 Remove top level state for unfinished flows in connector form #20135

Merged
merged 33 commits into from
Dec 13, 2022

Conversation

flash1293
Copy link
Contributor

Part of #14250

Based on #20132 (wait until merged)

What

This PR removes the top level state for "unfinished flows" (the confirm control to "open" a secret field and submit it) and pulls it into local component state.

This is one step towards removing the ui-widget state completely from the connector form to make it easier to reason about state handling as well as integrating it in other places.

How

  • Remove all "unfinished flow" state handling and passing around of props related to it
  • Introduce a new local state in the confirmation control to do the same thing
    • Consolidate the difference between secret text area and password input into the confirmation control (naming it SecretConfirmationControl as it's not used anywhere else) to avoid the local state leaking out of that component
    • Listen to the global formik state - if the dirty flag flips to false but there is a "previous value", reset that as well

🚨 User Impact 🚨

There is one small detail which changed based on this - the "Save changes and test" button would be disabled as long as the "unfinished flow" still exists. As there is no global state anymore to inform the button a secret is in the process of being edited, it will allow to "retest" even if the secret editing is not "finished" yet.

I don't see a UX problem with this change (especially as it's only affecting editing an existing connector but not creating a new one), but if there is a strong reason it can't work this way we can introduce a boolean top level state to pass this information around.

@octavia-squidington-iv octavia-squidington-iv added the area/platform issues related to the platform label Dec 6, 2022
Joe Reuter and others added 17 commits December 6, 2022 15:53
….module.scss

Co-authored-by: Tim Roes <tim@airbyte.io>
…irbytehq/airbyte into flash1293/connector-form-loading-state
@flash1293 flash1293 marked this pull request as ready for review December 12, 2022 12:25
@flash1293 flash1293 requested a review from a team as a code owner December 12, 2022 12:25
value={field.value ?? ""}
type="password"
disabled={disabled}
error={error}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something I noticed while testing: the secret input border is not set to red when it has an error
Screen Shot 2022-12-12 at 11 58 57 AM

I think this is because the error prop is not being passed to this component from Control.tsx

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, seems like it's like that on master too. Should be fixed:
Screenshot 2022-12-12 at 21 24 38

Copy link
Contributor

@lmossman lmossman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a couple more small questions but overall this looks good to me. Tested locally and it seems to work as expected. The small UX change you called out also feels fine to me

Comment on lines +59 to +63
useEffect(() => {
if (!dirty && !touched && previousValue) {
setPreviousValue(undefined);
}
}, [dirty, helpers, previousValue, touched]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Listen to the global formik state - if the dirty flag flips to false but there is a "previous value", reset that as well

Just to confirm my understanding: this code is basically ensuring that if the formik form is reset back to the initial state, then the previousValue state will be cleared out? An in practice, this would happen if a user clicks the Cancel button at the bottom of the ConnectorForm

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, if the form-level "Cancel" button is hit, all open secret controls are "closed" as well.


const component =
multiline && (isEditInProgress || !showButtons) ? (
<SecretTextArea
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed a couple small styling differences with the text area component which I put up a small PR here to fix: #20397

@flash1293
Copy link
Contributor Author

Thanks for the review, @lmossman

I addressed your comments and also fixed a bit the styling by adding a gap and top-aligning the cancel/done buttons instead of centering them (which looked really weird for textareas):
Screenshot 2022-12-13 at 10 06 24
Screenshot 2022-12-13 at 10 06 41

@flash1293 flash1293 merged commit 75dcf82 into master Dec 13, 2022
@flash1293 flash1293 deleted the flash1293/connector-form-unifinished-flows branch December 13, 2022 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend Related to the Airbyte webapp area/platform issues related to the platform team/extensibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants