[SignInPage] Remove docs context from component logic#4489
[SignInPage] Remove docs context from component logic#4489bharatkashyap merged 8 commits intomui:masterfrom
docs context from component logic#4489Conversation
…xt' of github.com:bharatkashyap/mui-toolpad into core/remove-docs-context
| setFormStatus((prev) => ({ | ||
| ...prev, | ||
| loading: oauthResponse?.error || docs ? false : prev.loading, | ||
| loading: false, |
There was a problem hiding this comment.
Shouldn't we keep the oauthResponse?.error logic here? If not should we just remove the loading and depend on whether it is defined in the prev?
There was a problem hiding this comment.
The idea in this code was to use oauthResponse?.error being defined as a way to check that the operation is complete and set the loading state to false (but create an escape hatch. for the docs since no oauthResponse is created inside the docs).
prev.loading will be true in all cases, and letting loading stay that way was done so that even if a response is received, the button would remain in a "loading" state till the OAuth redirect occurs, to visually indicate to the user that something is still "pending". This behaviour is present only in the oauth case, since none of the other auth methods involve an intermediate redirect.
On second thought, I feel it's a nice detail to let the user know that the redirect is pending, so what I feel we can do is to simply remove the additional docs check here, and change the oauth docs demos to return a mock error with "this is a fake error message", so that the button goes back into the default state.
| Current | After this PR |
|---|---|
Screen.Recording.2024-12-05.at.6.37.27.PM.mov |
Screen.Recording.2024-12-05.at.6.38.00.PM.mov |
slotPropofautoFocus: falseto each docs demo and removed handling it inside the component