-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
issue: formState.isLoading always returns true #9934
Comments
Your sandbox link contains the default RHF template; no reproduction. Please update your sandbox with the reproduction code |
Done! |
I'm a bit rusty with how the change to the @bluebill1049, I might need your help on this one 🤗 |
thanks @Moshyfawn i will look into this one. |
@crashtech If you are not using async defaultValues, what's the use case for subscribing to |
That's a good question, actually. I guess, it feels like |
Yea, if you are providing static |
I'm connecting react hook forms with Semantic UI, so I'm forwarding this prop to the UI component. It should be consistent, regardless of using asynchronous default values. Plus, a form here doesn't have default values, but select options are loaded asynchronously. |
Select options loading doesn't have anything to do with |
Well, I assume "the form is loading if it can't be used yet". But regardless the reason, it should be undefined, or false at least. The state is wrong, regardless of the motivation about using it. The idea is to use the state to disable inputs while options are still loading. |
I think this argument is going in a loop, the point is you don't need isLoading in the first place, whether we return the correct state for your UI or not is our responsibility. Yes, we can fix that, but you shouldn't use that in the first place. So I would suggest fixing your app logic first, while we patch this later on. |
But you are not using async |
So you should mention that is loading is a exclusive prop when using async default values. Or even rename it to make it clear that is not the form that is loading, is just the default values. In order to add an external support to that, I would have to add an exclusive provider just so it can be captured down the tree. Not even the override on the FormProvider works. |
Version Number
7.43.1
Codesandbox/Expo snack
https://codesandbox.io/s/nice-gould-tzmvfo?file=/src/App.js
Steps to reproduce
FormProvider
makesisLoading
always return true<FormProvider {...hook} formState={{ ...hook.formState, isLoading: false }}>
doesn't workExpected behaviour
The default value for
isLoading
should be false, especially ifdefaultValues
hasn't been provided, or if it hasn't been assigned to a Promise.What browsers are you seeing the problem on?
Chrome
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: