Skip to content

Conversation

@yuskithedeveloper
Copy link
Contributor

@yuskithedeveloper yuskithedeveloper commented Sep 19, 2025

Description

Removed saved for later mutations batching and implemented optimistic responses support so the client doesn't wait the server to respond to rerender

References

Jira-link:

https://virtocommerce.atlassian.net/browse/VCST-3928

Artifact URL:

https://vc3prerelease.blob.core.windows.net/packages/vc-theme-b2b-vue-2.35.0-pr-1956-5412-5412bdfc.zip

@yuskithedeveloper
Copy link
Contributor Author

Closed until an optimistic response support for batched requests would be implemented

@yuskithedeveloper yuskithedeveloper marked this pull request as ready for review October 23, 2025 16:14
@yuskithedeveloper yuskithedeveloper requested a review from a team as a code owner October 23, 2025 16:14
@yuskithedeveloper yuskithedeveloper requested review from Andrew-Orlov, goldenmaya, ivan-kalachikov and muller39 and removed request for a team October 23, 2025 16:14
@cursor
Copy link

cursor bot commented Oct 23, 2025

Bug: Optimistic Move Bug Causes UI Discrepancy

The moveFromSavedForLater optimistic response only removes items from the saved-for-later list but doesn't add them to the cart. This causes items to temporarily disappear from the UI until the server response arrives.

Fix in Cursor Fix in Web

@cursor
Copy link

cursor bot commented Oct 23, 2025

Bug: Optimistic UI Fails to Update Destination Lists

The optimistic responses for moveToSavedForLater and moveFromSavedForLater only simulate the removal of items from their source list. They don't also optimistically add these items to their destination list (saved for later or cart, respectively). This results in items temporarily disappearing from the UI until the server response arrives.

Additional Locations (1)

Fix in Cursor Fix in Web

@cursor
Copy link

cursor bot commented Oct 23, 2025

Bug: Undefined Variable Causes Length Access Error

The movedItemIds variable might be undefined if vars.command?.lineItemIds is missing. Accessing .length on an undefined value in this case would lead to a TypeError.

Additional Locations (1)

Fix in Cursor Fix in Web

cursor[bot]

This comment was marked as outdated.

@yuskithedeveloper
Copy link
Contributor Author

About Cursor comments

  1. Product line items are removed from the cart (or 'saved for later' list) to enhance the user experience; however, they aren't added to the 'saved for later' list (or cart) until the request succeeds.
    This was done intentionally to avoid user interaction with phantom records (such as changing the buyable quantity for a product that is not present in the cart yet).

  2. optimisticResponse method 'vars' parameter is passed by Apollo, it's not null or undefined and contains the command data


if (!movedItemIds?.length || !cart.value || !savedForLaterList.value) {
return IGNORE;
}
Copy link

Choose a reason for hiding this comment

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

Bug: Bug

Optimistic responses for moving items to/from 'saved for later' are ignored if savedForLaterList.value is undefined. This happens when the savedForLaterList hasn't loaded yet, creating a race condition that prevents immediate UI updates.

Fix in Cursor Fix in Web

@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 5, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants