mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-02-19 08:16:37 +00:00
Ensured list filtering params are reset when list component unmounts
This commit is contained in:
@@ -11,7 +11,7 @@ import { serverType } from '../servers/prop-types';
|
||||
import { ShortUrlsRow } from './helpers/ShortUrlsRow';
|
||||
import { listShortUrls, shortUrlType } from './reducers/shortUrlsList';
|
||||
import './ShortUrlsList.scss';
|
||||
import { shortUrlsListParamsType } from './reducers/shortUrlsListParams';
|
||||
import { shortUrlsListParamsType, resetShortUrlParams } from './reducers/shortUrlsListParams';
|
||||
|
||||
const SORTABLE_FIELDS = {
|
||||
dateCreated: 'Created at',
|
||||
@@ -23,6 +23,7 @@ const SORTABLE_FIELDS = {
|
||||
export class ShortUrlsListComponent extends React.Component {
|
||||
static propTypes = {
|
||||
listShortUrls: PropTypes.func,
|
||||
resetShortUrlParams: PropTypes.func,
|
||||
shortUrlsListParams: shortUrlsListParamsType,
|
||||
match: 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 });
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
const { resetShortUrlParams } = this.props;
|
||||
|
||||
resetShortUrlParams();
|
||||
}
|
||||
|
||||
renderShortUrls() {
|
||||
const { shortUrlsList, selectedServer, loading, error, shortUrlsListParams } = this.props;
|
||||
|
||||
@@ -188,7 +195,7 @@ export class ShortUrlsListComponent extends React.Component {
|
||||
|
||||
const ShortUrlsList = connect(
|
||||
pick([ 'selectedServer', 'shortUrlsListParams' ]),
|
||||
{ listShortUrls }
|
||||
{ listShortUrls, resetShortUrlParams }
|
||||
)(ShortUrlsListComponent);
|
||||
|
||||
export default ShortUrlsList;
|
||||
|
||||
Reference in New Issue
Block a user