mirror of
https://github.com/flarum/framework.git
synced 2024-11-28 20:16:08 +08:00
Make sure discussion list is refreshed if it needs to be
This commit is contained in:
parent
6a57ff8b51
commit
42d02569ac
|
@ -35,12 +35,25 @@ export default class IndexPage extends Component {
|
|||
app.cache.discussionList = null;
|
||||
}
|
||||
|
||||
if (!app.cache.discussionList) {
|
||||
app.cache.discussionList = new DiscussionList({
|
||||
params: this.params()
|
||||
const params = this.params();
|
||||
|
||||
if (app.cache.discussionList) {
|
||||
// Compare the requested parameters (sort, search query) to the ones that
|
||||
// are currently present in the cached discussion list. If they differ, we
|
||||
// will clear the cache and set up a new discussion list component with
|
||||
// the new parameters.
|
||||
Object.keys(params).some(key => {
|
||||
if (app.cache.discussionList.props.params[key] !== params[key]) {
|
||||
app.cache.discussionList = null;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!app.cache.discussionList) {
|
||||
app.cache.discussionList = new DiscussionList({params});
|
||||
}
|
||||
|
||||
app.history.push('index');
|
||||
app.current = this;
|
||||
app.drawer.hide();
|
||||
|
|
Loading…
Reference in New Issue
Block a user