mirror of
https://github.com/flarum/core.git
synced 2025-07-20 16:21:18 +02:00
Don't destroy discussion list in case of a redraw
i.e. the one in index-page’s onunload → composer.minimize
This commit is contained in:
@@ -3,7 +3,9 @@ import NavItem from 'flarum/components/nav-item'
|
|||||||
export default class IndexNavItem extends NavItem {
|
export default class IndexNavItem extends NavItem {
|
||||||
static props(props) {
|
static props(props) {
|
||||||
props.onclick = props.onclick || function() {
|
props.onclick = props.onclick || function() {
|
||||||
app.cache.discussionList = null;
|
if (app.cache.discussionList) {
|
||||||
|
app.cache.discussionList.forceReload = true;
|
||||||
|
}
|
||||||
m.redraw.strategy('none');
|
m.redraw.strategy('none');
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -43,6 +43,9 @@ export default class IndexPage extends Component {
|
|||||||
// are currently present in the cached discussion list. If they differ, we
|
// 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
|
// will clear the cache and set up a new discussion list component with
|
||||||
// the new parameters.
|
// the new parameters.
|
||||||
|
if (app.cache.discussionList.forceReload) {
|
||||||
|
app.cache.discussionList = null;
|
||||||
|
} else {
|
||||||
Object.keys(params).some(key => {
|
Object.keys(params).some(key => {
|
||||||
if (app.cache.discussionList.props.params[key] !== params[key]) {
|
if (app.cache.discussionList.props.params[key] !== params[key]) {
|
||||||
app.cache.discussionList = null;
|
app.cache.discussionList = null;
|
||||||
@@ -50,6 +53,7 @@ export default class IndexPage extends Component {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!app.cache.discussionList) {
|
if (!app.cache.discussionList) {
|
||||||
app.cache.discussionList = new DiscussionList({ params });
|
app.cache.discussionList = new DiscussionList({ params });
|
||||||
|
Reference in New Issue
Block a user