refinedev / refine

A React Framework for building internal tools, admin panels, dashboards & B2B apps with unmatched flexibility.
https://refine.dev
MIT License
25.99k stars 1.97k forks source link

[FEAT] Have an optional to reset from when close modal inside `useModalForm` #5954

Open Dominic-Preap opened 1 month ago

Dominic-Preap commented 1 month ago

Is your feature request related to a problem? Please describe.

Hi, I would like to have option to reset the form value to defaultValues when use close() in useModalForm hooks.

There are 2 issues, I'm facing:

To bypass the issue, we call reset() then close().

Describe alternatives you've considered

It would be nice to have another option inside useModalForm when user want to reset form after closing the form not just by summitted. For example

useModalForm({
    refineCoreProps: { action: 'create' },
    defaultValues,
    modalProps: {
      autoResetFormWhenClose: true // <-- something like this
    }
    resolver: valibotResolver(schema)
  });

Additional context

N/A

Describe the thing to improve

N/A

GANES1998 commented 1 month ago

@Dominic-Preap and @alicanerdurmaz, I am interested in this issue. Can you please assign it to me? Also, can you please guide me on the solution

Xajid commented 1 month ago

@Dominic-Preap I'd like to work on this one. Please assign it to me, I'd be happy to contribute.

BatuhanW commented 1 month ago

Hey @GANES1998 assigned issue to you, if we don't hear back from you, we'll assign it to @Xajid

GANES1998 commented 1 month ago

Hi @BatuhanW, Thanks for assigning to me. I'll work on this.

bhargavpshah98 commented 4 weeks ago

Hey @Dominic-Preap , I am interested to work on this issue. Can you please assign it to me if it is still unsolved ?

BatuhanW commented 2 weeks ago

@bhargavpshah98 are you still interested working on this issue?

bhargavpshah98 commented 1 week ago

Hello @BatuhanW , Yes I am interested