dohomi / react-hook-form-mui

Material-UI form components ready to use with react-hook-form
https://react-hook-form-material-ui.vercel.app
MIT License
535 stars 108 forks source link

Feature Request: Add support for isLoading on FormState #270

Closed NicholasMata closed 1 week ago

NicholasMata commented 4 months ago

Duplicates

Latest version

Summary 💡

The following is a proposal to add support for isLoading property on FormState.

isLoading is used to track the loading of defaultValues when it is an asynchronous function.

I would like to propose adding custom skeletons for all the components this library provides. Which will appear when isLoading is true on FormState.

NOTE: I am willing to take on the work, if you are open to the proposal.

Examples 🌈

Current Behavior: When an asynchronous defaultValues is provided the fields remain empty/blank but still allow for user interaction. Then once defaultValues completes all fields get set.

Expected Behavior: When an asynchronous defaultValues is provided the fields will display a skeleton based on the component which will not allow for user interactions. Then once defaultValues completes all fields get set.

sadik-malik commented 1 week ago

@NicholasMata, you can create a wrapper component to achieve the behavior of displaying a skeleton when formState.isLoading is true.

Including a skeleton or loader for components like TextField, Radio, etc., would introduce unnecessary overhead to the library. This is something that I believe should be handled by the developer on their own.