-
Notifications
You must be signed in to change notification settings - Fork 888
refactor: Extract ssh logic from auth service #5670
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
Conversation
Co-authored-by: Kira Pilot <[email protected]>
confirmLoading={authState.matches( | ||
"signedIn.ssh.loaded.regeneratingSSHKey", | ||
)} | ||
open={sshState.matches("confirmSSHKeyRegenerate")} |
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.
Sometimes we're making variables for sshState keys and sometimes we aren't - can we choose one and be consistent?
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 matches function only return true or false. Unfortunately, xstate v4 does not have a way to bind a context type with a specific state so, sometimes, we have to check the state with match and pass the value in the context. Buuut, after these minor refactoring, I think we can remove some xstate machines and use just use fetch directly.
}), | ||
notifySuccessSSHKeyRegenerated: () => { | ||
displaySuccess(Language.successRegenerateSSHKey) | ||
}, |
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.
:D we love to see it
}, | ||
}, | ||
notLoaded: { | ||
type: "final", |
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.
Thinking about our conversation about simplifying XState machines by having less granularity: instead of making a separate error, getSSHKeyError
, can we instead look at sshState.matches("notLoaded")
?
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.
In this case we store this because we want to display the error.
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.
Oh, I didn't see the separate loading state - makes sense!
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.
What a pleasant cleanup.
SSH can be a separated machine since it is not related to the authentication at all.