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

Store: Product Trash Pickup #21810

Merged
merged 5 commits into from
Jan 25, 2018
Merged

Conversation

justinshreve
Copy link
Contributor

This PR does some trash pickup around products. The following issues are addressed:

To Test:

  • Run npm run test-client client/extensions/woocommerce and make sure all tests pass.
  • Go to an existing product and click the pencil icon, verifying that the SKU input becomes editable. Close the input.
  • Add an entity ( & ) to your title and click save. Verify that the success message and input field don’t replace your & with &.
  • Open your dev console.
  • Click “Add” on the sidebar, and verify that you are taken to the add a product form. Verify that the form loads and there is not a huge warning explosion in your console.
  • Create a new product and give it a SKU that matches an existing SKU. Save and verify you get the duplicate SKU error message. Change your SKU, save, and verify the product saves.
  • When you are redirected to the products list, verify products are correctly listed.

@justinshreve justinshreve added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. Store labels Jan 24, 2018
@matticbot
Copy link
Contributor

Test live in Docker at: https://dserve.a8c.com/?branch=fix/store-product-trashpickup

@justinshreve justinshreve self-assigned this Jan 24, 2018
@justinshreve justinshreve requested a review from a team January 24, 2018 23:51
Copy link
Contributor

@timmyc timmyc left a comment

Choose a reason for hiding this comment

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

Couple of questions but this is testing out great. Thanks so much for fixing the edit -> add bug. I feel that is a highly used flow for someone setting up a new store.

@@ -190,6 +188,10 @@ class ProductCreate extends React.Component {
const isBusy = Boolean( actionList ); // If there's an action list present, we're trying to save.
const saveEnabled = isValid && ! isBusy && 0 === this.state.isUploading.length;

if ( ! product || isNumber( product.id ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm groking the check for ! product but the second clause has me thinking a bit - so this is to short circuit the create view if a product exists and is not a placeholder/un-saved product?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah.

I found in testing, the few actions that clear away edits in product UI state, variations, etc (which also resets currentlyEditingId and this product object) might not have all ran yet before the component mounts. And because of how the CompactTinyMCE component works, (it only an initial value), this is needed to prevent rendering of the form in that brief moment of time. Once the prop updates the form renders.

@@ -45,7 +45,6 @@ export default class ProductFormDetailsCard extends Component {

this.setName = this.setName.bind( this );
this.setDescription = this.setDescription.bind( this );
this.debouncedSetDescription = debounce( this.setDescription, 200 );
Copy link
Contributor

Choose a reason for hiding this comment

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

When trying to track down this bug, this did jump out at me - what was the original reason for this logic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure now, sorry. It doesn't seem necessary from the testing I did though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like it was added in here #14944 though i don't see any details around that specific bit. I think this might be some carry-over from patterns in the post editor maybe. But I agree if its not needed, it is great to remove it.

Copy link
Contributor

@timmyc timmyc left a comment

Choose a reason for hiding this comment

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

🙌

@timmyc timmyc added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jan 25, 2018
@justinshreve justinshreve merged commit 72ae0d7 into master Jan 25, 2018
@justinshreve justinshreve deleted the fix/store-product-trashpickup branch January 25, 2018 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants