Skip to content

Conversation

@joshheald
Copy link
Contributor

@joshheald joshheald commented Nov 25, 2025

Follows #16399

Description

This PR updates the displayed variations in an item list when their names change.

Previously, we observed changes to the variation, but not its attributes. Attributes make up the name of a variation, so it meant we didn't update the name when we needed to.

To fix that, we observe the attributes and variation attributes, and make sure we delete and recreate them on incremental updates.

Test Steps

  1. Open POS and perform a full sync in settings
  2. Open a variable product
  3. Edit the variable parent product's attributes in wp-admin
  4. Pull to refresh to force an incremental sync
  5. Observe that the variations names update
  6. Edit the attributes of a few variations in wp-admin
  7. Pull to refresh again
  8. Observe that the names update

Screenshots

variation.name.changes.mp4

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

@joshheald joshheald assigned joshheald and unassigned joshheald Nov 25, 2025
@joshheald joshheald added this to the 23.8 milestone Nov 25, 2025
@dangermattic
Copy link
Collaborator

dangermattic commented Nov 25, 2025

1 Warning
⚠️ This PR is assigned to the milestone 23.8. This milestone is due in less than 2 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Nov 25, 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 Numberpr16400-1e785ef
Version23.7
Bundle IDcom.automattic.alpha.woocommerce
Commit1e785ef
Installation URL2tk40ac99e5fo
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@iamgabrielma iamgabrielma self-assigned this Nov 26, 2025
Copy link
Contributor

@iamgabrielma iamgabrielma left a comment

Choose a reason for hiding this comment

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

LGTM!

// Fetch parent product with updated attributes
struct ParentProductWithAttributes: Decodable, FetchableRecord {
let product: PersistedProduct
let attributes: [PersistedProductAttribute]?
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: Does attributes need to be nullable here? (I think is always present but could be empty) Otherwise we can remove the optional and simplify the nil-coalescing below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch

Base automatically changed from woomob-1740-local-catalog-variations-can-get-duplicated-attributes-in to trunk November 26, 2025 07:49
@joshheald joshheald marked this pull request as ready for review November 26, 2025 08:07
@joshheald joshheald enabled auto-merge November 26, 2025 08:07
@joshheald joshheald merged commit 0ca913c into trunk Nov 26, 2025
15 checks passed
@joshheald joshheald deleted the fix-observation-of-variation-attributes branch November 26, 2025 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants