From 31cbe76bd0b13fe2dfcecbc6b9b8b20f22328a75 Mon Sep 17 00:00:00 2001 From: chrislearn Date: Wed, 16 Aug 2017 09:50:44 +0800 Subject: [PATCH] list query filter --- src/widgets/list/List.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/widgets/list/List.js b/src/widgets/list/List.js index 466a4a5..7758d6d 100644 --- a/src/widgets/list/List.js +++ b/src/widgets/list/List.js @@ -40,7 +40,7 @@ export class List extends Component { } updateQuery(props) { - this.query = { ...(this.query || emptyQuery) } + this.query = { ...emptyQuery } const newQuery = props.query || {} for (const i in this.query) { if (newQuery[i] != null) { @@ -79,11 +79,9 @@ export class List extends Component { this.loadReaction = reaction(() => store.records.map((record) => record.id), ids => this.loadData()) } componentWillReceiveProps(nextProps) { - if (this.props.query != nextProps.query) { - this.loadData(nextProps); - } else if (this.props.entityName !== nextProps.entityName) { - this.loadData(nextProps) - } + this.updateQuery(nextProps) + this.syncQueryToUrl() + this.loadData(nextProps); } componentWillUnmount() { this.loadReaction()