Skip to content

[BUG] MUI useModalForm() can't edit the same resource ID back to back #6904

@gdongca

Description

@gdongca

Describe the bug

A edit dialog implemented with useModalForm() will work well if every time I tried to open to edit a different resource id, but will always fail to populate the data if I open the same resource as the last-open one.

Steps To Reproduce

I am using the MUI useModalForm() in a resource list page to to edit selected resource by users. I created a Edit dialog component, and embedded a single instance at the end of the page.

  • When I open the modal (action='edit') the first time on a resource id, it was able to read the resource and populate the form with correct data.
  • When I opened the modal on the same resource id again (back to back), it failed to populate the form data. All the fields are empty.
  • If I tried to open a "different" resource id than the last-open id, it started working again.
  • Note: the isDirty state is also not reset between different edit sessions, and it is not consistent with the dirtyFields value.

Expected behavior

I expect that open to edit the same resource back-to-back will still work.

Packages

"@refinedev/core": "^4.57.9",
"@refinedev/mui": "^6.2.1",
"@refinedev/nextjs-router": "^6.2.3",
"@refinedev/react-hook-form": "^4.10.2",

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions