-
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
Auth Button now shows re-authenticate when it has been authenticated once #15615
Conversation
…shows the expected value.
}; | ||
|
||
const { run, loading, done } = useRunOauthFlow(connector, onDone); | ||
const connectionObjectEmpty = !!Object.keys((values?.connectionConfiguration as object) ?? {}).length; |
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.
Wouldn't that simply check if there is any configuration parameter set, i.e. this could be also any other parameter of the form being set?
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.
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.
Avoid calling functions and allocating empty objects unecessarily just to get a length of 0/
const connectionObjectEmpty = !!Object.keys((values?.connectionConfiguration as object) ?? {}).length; | |
const connectionObjectEmpty = !values?.connectionConfiguration ?? Object.keys(values?.connectionConfiguration as object).length > 0; |
I think the original issue talks about the text on the button not the success message? The Authentication button at the moment states "Reauthenticate ..." when you already authenticated. This doesn't seem to be addressed by this PR. |
Previously it would always show |
@edmundito maybe you could clarify here since you wrote the issue? |
I tested this and it may have fixed some other problem, but what's in the issue can be reproduced:
|
@edmundito Should be fixed! Also can you clarify with Tim about the messaging? I believe this ticket doesn't require any special messaging and should be fine as-is. |
}; | ||
|
||
const { run, loading, done } = useRunOauthFlow(connector, onDone); | ||
const connectionObjectEmpty = | ||
values?.connectionConfiguration?.credentials ?? values?.connectionConfiguration | ||
? Object.keys(values.connectionConfiguration?.credentials ?? values.connectionConfiguration).length <= 1 |
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.
values.connectionConfiguration
is the object in the Formik form values that contains all the configuration of the connector, meaning that it may return an incorrect values if the user fills out all the fields except oauth because it would mean that values.connectionConfiguration > 1, therefore not empty?
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.
Just pushed a change that catches this. This is such a complex workflow!
…tton-better-persistence
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.
Code looks good. Tested create new connector (mailchimp and google sheets), and the settings.
…once (airbytehq#15615) * Auth Button now knows if the connection object is full or empty, and shows the expected value. * Some types, better oauth finished calculation * values => preparedValues * Fixing test
Resolves #14226