Frank-Shanghai / PencilCase

0 stars 0 forks source link

Defect - Product editor changes not applied when click edit again just after saving #61

Closed Frank-Shanghai closed 6 years ago

Frank-Shanghai commented 6 years ago
  1. Try to edit one product, e.g., change name from {name} to {name}1.
  2. Save.
  3. Click Edit.

Expected result: In editing mode, product name field value should be {name}1.

Actual result: Product name field is the old one {name}.

Cause: PageEditor.ts Field value was set back to original value due to the call to reSetEditingFields when entering editing mode. Need to apply changes to the "this.parameters.product" when saving changes to avoid this issue. private startEditing = () => { this.isInEditingMode(true); this.reSetEditingFields(); }

private reSetEditingFields = () => {
    this.name(this.parameters.product.Name);
    this.description(this.parameters.product.Description);
    this.inventory(this.parameters.product.Inventory);
    this.retailPrice(this.parameters.product.RetailPrice);
    this.retailWholesalePrice(this.parameters.product.RetailWholesalePrice);
    this.times(this.parameters.product.Times);
    this.retailUnit(this.parameters.product.RetailUnit);
    this.wholesaleUnit(this.parameters.product.WholesaleUnit);
    this.wholesalePrice(this.parameters.product.WholesalePrice);
    this.imageSource(this.parameters.product.Image);
}