Skip to content

Commit

Permalink
fix(admin-ui): Refetch orders list on channel change
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Aug 26, 2020
1 parent fa29805 commit ffa5615
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { FormControl } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { merge } from 'rxjs';
import { debounceTime, takeUntil } from 'rxjs/operators';

import { BaseListComponent } from '@vendure/admin-ui/core';
import { GetOrderList, SortOrder } from '@vendure/admin-ui/core';
import { DataService } from '@vendure/admin-ui/core';
import { merge } from 'rxjs';
import { debounceTime, takeUntil } from 'rxjs/operators';

@Component({
selector: 'vdr-order-list',
Expand All @@ -22,7 +21,7 @@ export class OrderListComponent extends BaseListComponent<GetOrderList.Query, Ge
constructor(private dataService: DataService, router: Router, route: ActivatedRoute) {
super(router, route);
super.setQueryFn(
(...args: any[]) => this.dataService.order.getOrders(...args),
(...args: any[]) => this.dataService.order.getOrders(...args).refetchOnChannelChange(),
data => data.orders,
(skip, take) => {
const stateFilter = this.stateFilter.value;
Expand All @@ -49,10 +48,7 @@ export class OrderListComponent extends BaseListComponent<GetOrderList.Query, Ge
ngOnInit() {
super.ngOnInit();
merge(this.searchTerm.valueChanges, this.stateFilter.valueChanges)
.pipe(
debounceTime(250),
takeUntil(this.destroy$),
)
.pipe(debounceTime(250), takeUntil(this.destroy$))
.subscribe(() => this.refresh());
}
}

0 comments on commit ffa5615

Please sign in to comment.