mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 09:30:31 +03:00
Ensured list filtering params are reset when list component unmounts
This commit is contained in:
parent
5d5a2be498
commit
9b3bfe56bb
1 changed files with 9 additions and 2 deletions
|
@ -11,7 +11,7 @@ import { serverType } from '../servers/prop-types';
|
||||||
import { ShortUrlsRow } from './helpers/ShortUrlsRow';
|
import { ShortUrlsRow } from './helpers/ShortUrlsRow';
|
||||||
import { listShortUrls, shortUrlType } from './reducers/shortUrlsList';
|
import { listShortUrls, shortUrlType } from './reducers/shortUrlsList';
|
||||||
import './ShortUrlsList.scss';
|
import './ShortUrlsList.scss';
|
||||||
import { shortUrlsListParamsType } from './reducers/shortUrlsListParams';
|
import { shortUrlsListParamsType, resetShortUrlParams } from './reducers/shortUrlsListParams';
|
||||||
|
|
||||||
const SORTABLE_FIELDS = {
|
const SORTABLE_FIELDS = {
|
||||||
dateCreated: 'Created at',
|
dateCreated: 'Created at',
|
||||||
|
@ -23,6 +23,7 @@ const SORTABLE_FIELDS = {
|
||||||
export class ShortUrlsListComponent extends React.Component {
|
export class ShortUrlsListComponent extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
listShortUrls: PropTypes.func,
|
listShortUrls: PropTypes.func,
|
||||||
|
resetShortUrlParams: PropTypes.func,
|
||||||
shortUrlsListParams: shortUrlsListParamsType,
|
shortUrlsListParams: shortUrlsListParamsType,
|
||||||
match: PropTypes.object,
|
match: PropTypes.object,
|
||||||
location: PropTypes.object,
|
location: PropTypes.object,
|
||||||
|
@ -89,6 +90,12 @@ export class ShortUrlsListComponent extends React.Component {
|
||||||
this.refreshList({ page: params.page, tags: query.tag ? [ query.tag ] : shortUrlsListParams.tags });
|
this.refreshList({ page: params.page, tags: query.tag ? [ query.tag ] : shortUrlsListParams.tags });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
const { resetShortUrlParams } = this.props;
|
||||||
|
|
||||||
|
resetShortUrlParams();
|
||||||
|
}
|
||||||
|
|
||||||
renderShortUrls() {
|
renderShortUrls() {
|
||||||
const { shortUrlsList, selectedServer, loading, error, shortUrlsListParams } = this.props;
|
const { shortUrlsList, selectedServer, loading, error, shortUrlsListParams } = this.props;
|
||||||
|
|
||||||
|
@ -188,7 +195,7 @@ export class ShortUrlsListComponent extends React.Component {
|
||||||
|
|
||||||
const ShortUrlsList = connect(
|
const ShortUrlsList = connect(
|
||||||
pick([ 'selectedServer', 'shortUrlsListParams' ]),
|
pick([ 'selectedServer', 'shortUrlsListParams' ]),
|
||||||
{ listShortUrls }
|
{ listShortUrls, resetShortUrlParams }
|
||||||
)(ShortUrlsListComponent);
|
)(ShortUrlsListComponent);
|
||||||
|
|
||||||
export default ShortUrlsList;
|
export default ShortUrlsList;
|
||||||
|
|
Loading…
Reference in a new issue