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

fix: save button is disabled in display name page in offline mode #28295

Merged
merged 3 commits into from
Sep 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/components/Form/FormProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ function FormProvider({validate, shouldValidateOnBlur, shouldValidateOnChange, c
onSubmit={submit}
inputRefs={inputRefs}
errors={errors}
enabledWhenOffline={enabledWhenOffline}
formState={formState}
Copy link
Member

Choose a reason for hiding this comment

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

Hey @akinwale Can you please explain the reason for formState prop? Good catch.

Copy link
Contributor Author

@akinwale akinwale Sep 27, 2023

Choose a reason for hiding this comment

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

The formState contains the isLoading property, which indicates whether or not the form is loading after submitting. When I was testing, I noticed the button loading state wasn't being updated, which was due to the formState not being properly forwarded.

Copy link
Member

Choose a reason for hiding this comment

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

Interesting. Now, it is giving me a feeling that there might be more such issues in this refactor. Anyways, thanks for the details. I will test it.

Copy link
Contributor

@staszekscp staszekscp Sep 27, 2023

Choose a reason for hiding this comment

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

In this case I wonder what would be the desired way of using the formState, because I see that originally it is taken from onyx in both: FormProvider and FormWrapper. After the suggested change we'll have two formState props overriding each other in FormWrapper - one passed as a direct prop, the second taken from onyx. I think it may cause some problems, what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I didn't notice the formState coming from Onyx. I guess I was just seeing some odd behaviour with the loading state when I was testing. I'll update and run some more tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. Not sure why I was seeing issues with loading earlier, but I cleared my browser caches and re-logged in just to make sure. Everything tests ok now.

>
{children}
</FormWrapper>
Expand Down