Page MenuHomePhabricator

[native] Handle unsaved changes when 'cancel' is pressed
ClosedPublic

Authored by rohan on Jun 9 2023, 11:36 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 9, 2:01 PM
Unknown Object (File)
Sat, Nov 9, 1:21 PM
Unknown Object (File)
Sat, Nov 9, 11:30 AM
Unknown Object (File)
Sat, Nov 9, 9:42 AM
Unknown Object (File)
Sat, Nov 9, 8:38 AM
Unknown Object (File)
Thu, Nov 7, 7:32 PM
Unknown Object (File)
Tue, Nov 5, 9:15 AM
Unknown Object (File)
Tue, Nov 5, 9:15 AM
Subscribers

Details

Summary

As a second part to the header left button, we want to ensure that a user is prompted with an alert warning them that they are discarding changes if they've selected a different role but not saved.

Depends on D8158

Test Plan

Please see the video below

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

rohan requested review of this revision.Jun 9 2023, 11:53 AM
rohan added inline comments.
native/roles/change-roles-header-left-button.react.js
32–41 ↗(On Diff #27588)

I think the wording here may be a bit confusing. In my experience, 'cancel' typically means close the alert, and there's another option like 'confirm' or something that will mean you're ok with discarding changes.

Here it seems like 'cancel' means we're ok with discarding changes. Not sure if it's just me though (cc @ted)

native/roles/change-roles-header-left-button.react.js
32–41 ↗(On Diff #27588)

What do we do in the current edit-message workflow? Heads-up I generally handle copy, not @ted

native/roles/change-roles-header-left-button.react.js
32–41 ↗(On Diff #27588)

Ah my bad. It looks like in message editing: Continue editing closes the alert and continues editing while Discard edit closes the alert and exits editing

native/roles/change-roles-header-left-button.react.js
32–41 ↗(On Diff #27588)
  1. I agree we shouldn't use the term Cancel here... how about Leave?
  2. I don't think we need { cancelable: true }... we can just default to Stay if the user dismisses the Alert
  3. Can we try to match copy for title / description with the edit-message workflow?
native/roles/change-roles-header-left-button.react.js
32–41 ↗(On Diff #27588)

Yeah that makes sense, I'll update the diff

atul requested changes to this revision.Jun 12 2023, 1:12 PM

Requesting changes for changes suggested by @ashoat.

It's not clear to me as of this diff how the user is supposed to save their changes, maybe that's more clear in a subsequent diff?

This revision now requires changes to proceed.Jun 12 2023, 1:12 PM
In D8159#241874, @atul wrote:

It's not clear to me as of this diff how the user is supposed to save their changes, maybe that's more clear in a subsequent diff?

Yeah changes are handled with the header right button in D8160

This revision is now accepted and ready to land.Jun 13 2023, 6:42 PM
native/roles/change-roles-header-left-button.react.js
34 ↗(On Diff #27667)

Missing a period at the end

This revision was landed with ongoing or failed builds.Jun 21 2023, 8:42 AM
This revision was automatically updated to reflect the committed changes.
native/roles/change-roles-header-left-button.react.js
34 ↗(On Diff #27968)

Still missing a period at the end

native/roles/change-roles-header-left-button.react.js
34 ↗(On Diff #27968)

Ah looks like it was addressed in D8277