Skip to content

Commit

Permalink
fix(admin-ui): Reset page when filters changed in product list
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed May 13, 2019
1 parent de7f22d commit c9325b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ export class ProductListComponent

setSearchTerm(term: string) {
this.searchTerm = term;
this.setQueryParam('q', term || null);
this.setQueryParam({ q: term || null, page: 1 });
this.refresh();
}

setFacetValueIds(ids: string[]) {
this.facetValueIds = ids;
this.setQueryParam('fvids', ids);
this.setQueryParam({ fvids: ids, page: 1 });
this.refresh();
}

Expand Down
6 changes: 4 additions & 2 deletions admin-ui/src/app/common/base-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,11 @@ export class BaseListComponent<ResultType, ItemType, VariableType = any> impleme
this.refresh$.next(undefined);
}

protected setQueryParam(key: string, value: any) {
protected setQueryParam(hash: { [key: string]: any });
protected setQueryParam(key: string, value: any);
protected setQueryParam(keyOrHash: string | { [key: string]: any }, value?: any) {
this.router.navigate(['./'], {
queryParams: { [key]: value },
queryParams: typeof keyOrHash === 'string' ? { [keyOrHash]: value } : keyOrHash,
relativeTo: this.route,
queryParamsHandling: 'merge',
});
Expand Down

0 comments on commit c9325b6

Please sign in to comment.