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

fix: variant clone produces null and undefined values #6149

Merged
merged 3 commits into from
Mar 18, 2020

Conversation

mikemurray
Copy link
Member

Resolves #6148
Impact: critical
Type: bugfix

Issue

Cloning a variant with that has missing values for title, optionTitle, length, width, height, and weight, would produce null values in the database. This breaks the API.

Solution

Ensure the values valid before inserting them into the database.

Breaking changes

none

Testing

  1. Use the reaction admin
  2. Clone a variant with options, but don't fill out the fields title, optionTitle, length, width, height, and weight
  3. Ensure everything clones correctly
  4. Now fill out the missing values and clone a variant that has options
  5. See everything clones correctly

Copy link
Member

@willopez willopez left a comment

Choose a reason for hiding this comment

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

Cloning variants now works correctly. However, it's not possible to set the price on a variant. When I set the price and click "Save changes" the prices gets cleared out to an empty string.

@mikemurray
Copy link
Member Author

@willopez I don't think this PR is the ultimate cause of these issues. In the Reaction Admin, I'm seeing missing price/compareAtPrice from the product GQL fragment.

I'm also noticing that the price field for variants with options is an object and not float to represent the price range. This is a bigger problem because a field in GQL is changing between two different types.

@mikemurray
Copy link
Member Author

@willopez Added a ticket about the price issue: #6152

@willopez
Copy link
Member

@mikemurray as discussed, we'll handle that issue in a separate PR.

Copy link
Member

@willopez willopez left a comment

Choose a reason for hiding this comment

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

LGTM

@willopez willopez merged commit 71d4e3d into trunk Mar 18, 2020
@kieckhafer kieckhafer mentioned this pull request Mar 19, 2020
@kieckhafer kieckhafer deleted the fix-6148-mikemurray-variant-clone branch March 24, 2020 17:12
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.

Cloning a product variant generates error that breaks the UI
2 participants