You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
During the review of PR #645, we identified opportunities to refactor the Modal component and the Add, Edit, and Delete forms to address some recurring problems and improve maintainability.
Existing Problems:
CloseX Component:
Each form currently implements its own CloseX component and a closeAndReset function to reset the form.
Form Reset on Modal Close (ESC):
Closing a modal using the ESC key happens at the Modal/HTMLDialogElement level. However, form values inside the modal were not reset when the modal was closed.
To address this, a useEffect hook was added to each form to wipe the values when the dependent object changes. While this works as a temporary fix, it’s not a long-term solution.
Proposed Solution:
Move the responsibility for resetting the form to the Modal component.
Refactor FormProps so they can be passed into the Modal along with the form itself, enabling the Modal to invoke reset() on any form.
This refactor would simplify form handling, reduce redundant code, and improve the maintainability of the Modal and related components.
The text was updated successfully, but these errors were encountered:
Description:
During the review of PR #645, we identified opportunities to refactor the
Modal
component and the Add, Edit, and Delete forms to address some recurring problems and improve maintainability.Existing Problems:
CloseX
component and acloseAndReset
function to reset the form.ESC
key happens at theModal/HTMLDialogElement
level. However, form values inside the modal were not reset when the modal was closed.useEffect
hook was added to each form to wipe the values when the dependent object changes. While this works as a temporary fix, it’s not a long-term solution.Proposed Solution:
Modal
component.FormProps
so they can be passed into theModal
along with the form itself, enabling theModal
to invokereset()
on any form.This refactor would simplify form handling, reduce redundant code, and improve the maintainability of the
Modal
and related components.The text was updated successfully, but these errors were encountered: