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: default for isLoading form state #10095

Merged
merged 1 commit into from Mar 13, 2023
Merged

fix: default for isLoading form state #10095

merged 1 commit into from Mar 13, 2023

Conversation

adamtowle
Copy link
Contributor

Mentioned here #9934.

This pull request fixes an issue with the isLoading functionality. Currently, the default value for defaultValues is always set to true, even if it's a static value. I have a component abstraction that subscribes to isLoading to display a loading state, but the default value was causing issues with the component's behaviour.

To address this, I've updated the defaultValues default to true only if it's a function, which allows the component to support both async and static defaultValues without any unexpected behaviour.

@codesandbox
Copy link

codesandbox bot commented Mar 13, 2023

CodeSandbox logoCodeSandbox logo  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

Copy link
Member

@bluebill1049 bluebill1049 left a comment

Choose a reason for hiding this comment

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

LGTM. thanks

@bluebill1049 bluebill1049 merged commit a68f683 into react-hook-form:master Mar 13, 2023
@adamtowle adamtowle deleted the fix/loading-form-state branch March 16, 2023 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants