Skip to content

Commit

Permalink
fix(admin-ui): Preserve variant price changes between list/table views
Browse files Browse the repository at this point in the history
Relates to #632
  • Loading branch information
michaelbromley committed Jan 15, 2021
1 parent 3a16d87 commit 43bd770
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ import {
import { DEFAULT_CHANNEL_CODE } from '@vendure/common/lib/shared-constants';
import { notNullOrUndefined } from '@vendure/common/lib/shared-utils';
import { PaginationInstance } from 'ngx-pagination';
import { Observable, Subscription } from 'rxjs';
import { Subscription } from 'rxjs';
import { debounceTime, distinctUntilChanged, map } from 'rxjs/operators';

import { AssetChange } from '../product-assets/product-assets.component';
import { VariantFormValue } from '../product-detail/product-detail.component';
import { SelectedAssets, VariantFormValue } from '../product-detail/product-detail.component';
import { UpdateProductOptionDialogComponent } from '../update-product-option-dialog/update-product-option-dialog.component';

export interface VariantAssetChange extends AssetChange {
Expand Down Expand Up @@ -116,11 +116,11 @@ export class ProductVariantsListComponent implements OnChanges, OnInit, OnDestro
this.pagination.currentPage = 1;
}
if (this.channelPriceIncludesTax != null && Object.keys(this.variantListPrice).length === 0) {
this.buildVariantListPrices(this.variants);
this.buildVariantListPrices(this.formArray.value);
}
}
if ('channelPriceIncludesTax' in changes) {
this.buildVariantListPrices(this.variants);
this.buildVariantListPrices(this.formArray.value);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ export class ProductVariantsTableComponent implements OnInit, OnChanges, OnDestr
ngOnChanges(changes: SimpleChanges) {
if ('variants' in changes) {
if (this.channelPriceIncludesTax != null && Object.keys(this.variantListPrice).length === 0) {
this.buildVariantListPrices(this.variants);
this.buildVariantListPrices(this.formArray.value);
}
}
if ('channelPriceIncludesTax' in changes) {
this.buildVariantListPrices(this.variants);
this.buildVariantListPrices(this.formArray.value);
}
}

Expand Down

0 comments on commit 43bd770

Please sign in to comment.