coronasafe / care_fe

Care is a Digital Public Good enabling TeleICU & Decentralised Administration of Healthcare Capacity across States.
https://care.ohc.network
MIT License
187 stars 349 forks source link

Implement 'Discard Changes' Modal for Form Editing Confirmation #7255

Open Keshav-0907 opened 4 months ago

Keshav-0907 commented 4 months ago

Is your feature request related to a problem? Please describe. Currently, when a user is updating a form with different fields and accidentally navigates away without saving, all updated data is lost.

Describe the solution you'd like To mitigate the risk of unintentional data loss, we can implement a 'Discard Changes' modal that would serve as a confirmation step before discarding any modifications.

Additional context ( Video : No confirmation model when form is updated and user navigates away )

https://github.com/coronasafe/care_fe/assets/91189139/17b71990-37f1-444c-9f06-05c488d3c235

Ashesh3 commented 4 months ago

We already have support for auto saving drafts for our <Form component, I think converting this basic html form to our higher order <Form component should resolve this issue alongside.

cc: @rithviknishad

rithviknishad commented 4 months ago

@Ashesh3 I think @Keshav-0907 meant more like a "Confirm Navigate Away" popup to prevent accidental navigations. Yes, we can always enable form restorations too on top of this.

image
Ashesh3 commented 4 months ago

@Ashesh3 I think @Keshav-0907 meant more like a "Confirm Navigate Away" popup to prevent accidental navigations. Yes, we can always enable form restorations too on top of this.

image

Yep, I got that, but since we don't have it anywhere else, even for the more imp and longer forms like consultation, patient etc. Instead of adding this popup for all existing long forms, I feel we should just upgrade this form to support drafts, that serves the same purpose to get users back their data in case they navigate away unintentionally. Just my thoughts, open to discussions!

This drafts solution also aligns with the required solution mentioned in the issue:

all updated data is lost. .... To mitigate the risk of unintentional data loss, ....

rithviknishad commented 4 months ago

I agree with @Ashesh3

@nihal467 / @gigincg / @aparnacoronasafe

Keshav-0907 commented 4 months ago

@Ashesh3 I think @Keshav-0907 meant more like a "Confirm Navigate Away" popup to prevent accidental navigations. Yes, we can always enable form restorations too on top of this.

image

@rithviknishad Sir, I actually meant to address the unintentional data loss concern by adding a 'Discard Changes' confirmation modal. However, following @Ashesh3's suggestion, I think upgrading the form for draft support can be a better approach.

I want to work on this issue. Can you please assign this to me?

Ashesh3 commented 4 months ago

@Ashesh3 I think @Keshav-0907 meant more like a "Confirm Navigate Away" popup to prevent accidental navigations. Yes, we can always enable form restorations too on top of this.

image

@rithviknishad Sir, I actually meant to address the unintentional data loss concern by adding a 'Discard Changes' confirmation modal. However, following @Ashesh3's suggestion, I think upgrading the form for draft support can be a better approach.

I want to work on this issue. Can you please assign this to me?

Hey, remember that our higher order <Form component already has drafts support, you just need to convert the shifting form to use that higher order <Form component. basically to convert basic html

to our custom <Form implementation which we already have.

github-actions[bot] commented 4 months ago

Hi, @gigincg, @nihal467, @khavinshankar, @mathew-alex, @aparnacoronasafe, This issue has been automatically marked as stale because it has not had any recent activity.

AshrafMd-1 commented 3 months ago

@Keshav-0907 are you still working on this issue? If not I would like to work on this

AshrafMd-1 commented 3 months ago

@rithviknishad it seems like @Keshav-0907 is inactive can you assign me this issue

github-actions[bot] commented 2 months ago

Hi, @gigincg, @nihal467, @khavinshankar, @mathew-alex, @aparnacoronasafe, This issue has been automatically marked as stale because it has not had any recent activity.

AshrafMd-1 commented 1 month ago

I am actually slightly busy in doing other issues [p2] so as of now I will unassign myself