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

The updateProductVariant mutation does not change the updatedAt field. #1101

Closed
skid opened this issue Sep 19, 2021 · 1 comment
Closed

The updateProductVariant mutation does not change the updatedAt field. #1101

skid opened this issue Sep 19, 2021 · 1 comment
Assignees
Labels
type: bug 🐛 Something isn't working

Comments

@skid
Copy link
Contributor

skid commented Sep 19, 2021

Describe the bug
The updatedAt field of a ProductVariant remains the same (equal to the createdAt) after updates.

To Reproduce

  1. Change the price of a product variant in the Admin UI and click update
  2. Check the database record for that PV

Expected behavior
The ProductVariant should have the updatedAt field set to its latest update date.
Additionally, this object should be passed to the event bus (for instance, if the updatedAt is a database timestamp, we should make sure that the actual in-memory entity instance reflects the new updatedAt date).

Environment (please complete the following information):

  • @vendure/core version: 1.2.0
  • Nodejs version 14
  • Database (mysql/postgres etc): 13
@skid skid added the type: bug 🐛 Something isn't working label Sep 19, 2021
@michaelbromley
Copy link
Member

Thanks for the report. This was really tricky to track down, but it turned out to be a bug in the translateDeep helper function which was copying over the "createdAt" and "updatedAt" values from the translation entity to the ProductVariant itself.

It's also worth noting that for all entities, the "updatedAt" only changes when its own properties are changed, not that of any related entities. Perhaps you already knew this but it might not be obvious that e.g. updating a variant's price or name will not change the "updatedAt" value, since it is the "ProductVariantPrice" and "ProductVariantTranslation" entities that are actually being updated respectively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants