Skip to content

Commit 29d1447

Browse files
authored
fix: Pagination does not reset to page 1 when clicking on class or filter (#2798)
1 parent 752841a commit 29d1447

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

src/components/CategoryList/CategoryList.react.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export default class CategoryList extends React.Component {
122122
return (
123123
<div key={id}>
124124
<div className={styles.link}>
125-
<Link title={c.name} to={{ pathname: link }} className={className} key={id}>
125+
<Link title={c.name} to={{ pathname: link }} className={className} key={id} onClick={() => this.props.classClicked()}>
126126
<span>{count}</span>
127127
<span>{c.name}</span>
128128
</Link>

src/dashboard/Data/Browser/Browser.react.js

+22-2
Original file line numberDiff line numberDiff line change
@@ -1883,8 +1883,28 @@ class Browser extends DashboardView {
18831883
current={current}
18841884
params={this.props.location?.search}
18851885
linkPrefix={'browser/'}
1886-
filterClicked={url => this.props.navigate(generatePath(this.context, url))}
1887-
removeFilter={filter => this.removeFilter(filter)}
1886+
filterClicked={url => {
1887+
// Reset to page 1
1888+
this.setState({
1889+
skip: 0,
1890+
});
1891+
1892+
this.props.navigate(generatePath(this.context, url));
1893+
}}
1894+
removeFilter={filter => {
1895+
// Reset to page 1
1896+
this.setState({
1897+
skip: 0,
1898+
});
1899+
1900+
this.removeFilter(filter)
1901+
}}
1902+
classClicked={() => {
1903+
// Reset to page 1
1904+
this.setState({
1905+
skip: 0,
1906+
});
1907+
}}
18881908
categories={allCategories}
18891909
/>
18901910
);

0 commit comments

Comments
 (0)