Skip to content

Conversation

@ealeksandrov
Copy link
Contributor

Closes: #7132

Description

This PR fixes race condition in Order Details screen, so products are always correctly loaded and displayed in edit flow.
Also it prevents some empty products sync requests when no data update is needed.

How

The method syncEverything in OrderDetailsViewModel have separate syncOrder() and syncProducts() calls which are run in parallel.
In fact, products sync depends on order, because simple order (from the list, non-cached previously) doesn't have items data with product ids to sync at all. This is an edge case, because usually products and/or order are already cached.

Testing

  1. Logout, log back in to clear cache.
  2. Go to Orders List.
  3. Open Order Details.
  4. Confirm products list with thumbnails is loaded (if products sync failed, list will also be there, but with basic data, no thumbnails)
  5. Tap "•••" in navbar. Select "Edit".
  6. Confirm products list is displayed correctly on Order Edit screen.

Screenshots

before after
Simulator Screen Shot - 1 Simulator Screen Shot - 3
Simulator Screen Shot - 2 Simulator Screen Shot - 4

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

@ealeksandrov ealeksandrov added the feature: order details Related to order details. label Jun 23, 2022
@ealeksandrov ealeksandrov added this to the 9.5 milestone Jun 23, 2022
@peril-woocommerce
Copy link

Warnings
⚠️ This PR is assigned to a milestone which is closing in less than 4 days Please, make sure to get it merged by then or assign it to a later expiring milestone

Generated by 🚫 dangerJS

@wpmobilebot
Copy link
Collaborator

You can test the changes from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr7142-15c27e8 on your iPhone

If you need access to App Center, please ask a maintainer to add you.

Copy link
Contributor

@Ecarrion Ecarrion left a comment

Choose a reason for hiding this comment

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

Works great! Thanks for fixing this @ealeksandrov!

@ealeksandrov ealeksandrov merged commit 0eae2a7 into trunk Jun 24, 2022
@ealeksandrov ealeksandrov deleted the issue/7132-fix-missing-products-request branch June 24, 2022 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: order details Related to order details.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Unified Order Editing] Products are not loaded after changing the store

4 participants