Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Order Editing] Show exit confirmation for unsynced changes in a split view #15394

Conversation

staskus
Copy link
Contributor

@staskus staskus commented Mar 21, 2025

Closes: #14962

Description

Canceling an order edit in split view with unsynced changes doesn't request confirmation.

Solution

  • Return false from canBeDismissed when the order is in a split-view and there are unsynced changes
  • Do not delete the order when dismissing in the .editing flow

Steps to reproduce

On iPad

Unsynced changes

  1. Orders
  2. Edit Order
  3. Change product selection
  4. Tap Cancel
  5. Confirm the alert appears (dismissing the alert results in recalculate issues fixed in github.com/woocommerce/woocommerce)

Synced changes

  1. Orders
  2. Edit Order
  3. Change product selection
  4. Tap Recalculate
  5. Tap Cancel
  6. Confirm the view is closed without an alert

Testing information

  • Re-tested order creation, editing, and dismissing on an iPhone.
  • Confirm order is resynced when other changes are made on right side in a split-view

Screenshots

Simulator.Screen.Recording.-.iPad.Air.11-inch.M2.-.2025-03-21.at.14.05.29.mp4

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on all devices (phone/tablet) and no regressions are added.

staskus added 2 commits March 21, 2025 13:58
In a single-view layout: Editing can always be dismissed because changes are committed instantly.
In a split-view layout: Editing can be dismissed when there aren't product changes pending to recalculate.

We also need to delete order when discarding changing during the creation flow.
@staskus staskus added type: bug A confirmed bug. feature: order creation All tasks related to creating an order labels Mar 21, 2025
@staskus staskus added this to the 22.1 milestone Mar 21, 2025
@staskus staskus marked this pull request as ready for review March 21, 2025 12:14
@staskus staskus requested a review from joshheald March 21, 2025 12:14
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Mar 21, 2025

App Icon📲 You can test the changes from this Pull Request in WooCommerce iOS Prototype by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS Prototype
Build Number29034
VersionPR #15394
Bundle IDcom.automattic.alpha.woocommerce
Commitb4bda32
Installation URL6cuk5la381lbo
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@joshheald joshheald self-assigned this Mar 27, 2025
Copy link
Contributor

@joshheald joshheald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well, thanks for this improvement.

Note that it doesn't totally finish fixing the issue though...

If you prevent the deletion, making an edit, tapping cancel, then continuing with the edit instead of discarding it breaks the Recalculate button (and I have no idea why...)

Repro is

  1. Tap edit
  2. Select another product
  3. Tap cancel
  4. Tap in the header area to dismiss the alert and stay on the order. (Using the header avoids accidentally selecting another product, which prevents repro.)
  5. Tap recalculate – observe nothing happens.

I still think this should be merged, you can work around the issue by changing selection again.

@staskus
Copy link
Contributor Author

staskus commented Mar 28, 2025

@joshheald

If you prevent the deletion, making an edit, tapping cancel, then continuing with the edit instead of discarding it breaks the Recalculate button (and I have no idea why...)

This was fixed in another PR - #15392 since it was also reported in a separate issue. Sorry for not connecting them both in the description!

staskus added 2 commits March 28, 2025 09:33
…edit-in-split-view-with-unsynced-changes-doesnt-request-confirmation
…edit-in-split-view-with-unsynced-changes-doesnt-request-confirmation
@staskus staskus enabled auto-merge March 28, 2025 07:34
@staskus staskus merged commit 877e2c2 into trunk Mar 28, 2025
13 checks passed
@staskus staskus deleted the fix/14962-order-editing-canceling-an-order-edit-in-split-view-with-unsynced-changes-doesnt-request-confirmation branch March 28, 2025 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: order creation All tasks related to creating an order type: bug A confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Order Editing] Cancelling an order edit in split view with unsynced changes doesn't request confirmation.
3 participants