mirror of
https://github.com/flarum/framework.git
synced 2024-12-12 22:53:37 +08:00
Performance improvements
This commit is contained in:
parent
ec65a15767
commit
8f7e563036
|
@ -125,7 +125,10 @@ export default class DiscussionList extends Component {
|
||||||
var active = m.route().substr(0, discussionRoute.length) === discussionRoute;
|
var active = m.route().substr(0, discussionRoute.length) === discussionRoute;
|
||||||
|
|
||||||
var subtree = this.subtrees[discussion.id()];
|
var subtree = this.subtrees[discussion.id()];
|
||||||
return m('li.discussion-summary'+(isUnread ? '.unread' : '')+(active ? '.active' : ''), {key: discussion.id(), 'data-id': discussion.id()}, (subtree && subtree.retain()) || m('div', [
|
return m('li.discussion-summary'+(isUnread ? '.unread' : '')+(active ? '.active' : ''), {
|
||||||
|
key: discussion.id(),
|
||||||
|
'data-id': discussion.id()
|
||||||
|
}, (subtree && subtree.retain()) || m('div', [
|
||||||
controls.length ? DropdownButton.component({
|
controls.length ? DropdownButton.component({
|
||||||
items: controls,
|
items: controls,
|
||||||
className: 'contextual-controls',
|
className: 'contextual-controls',
|
||||||
|
|
|
@ -38,10 +38,11 @@ export default class DiscussionPage extends mixin(Component, evented) {
|
||||||
if (app.cache.discussionList) {
|
if (app.cache.discussionList) {
|
||||||
if (!(app.current instanceof DiscussionPage)) {
|
if (!(app.current instanceof DiscussionPage)) {
|
||||||
app.cache.discussionList.subtrees.map(subtree => subtree.invalidate());
|
app.cache.discussionList.subtrees.map(subtree => subtree.invalidate());
|
||||||
|
} else {
|
||||||
|
m.redraw.strategy('diff'); // otherwise pane redraws (killing retained subtrees) and mouseenter even is triggered so it doesn't hide
|
||||||
}
|
}
|
||||||
app.pane.enable();
|
app.pane.enable();
|
||||||
app.pane.hide();
|
app.pane.hide();
|
||||||
m.redraw.strategy('diff'); // otherwise pane redraws and mouseenter even is triggered so it doesn't hide
|
|
||||||
}
|
}
|
||||||
|
|
||||||
app.history.push('discussion');
|
app.history.push('discussion');
|
||||||
|
@ -57,7 +58,9 @@ export default class DiscussionPage extends mixin(Component, evented) {
|
||||||
params.include = params.include.join(',');
|
params.include = params.include.join(',');
|
||||||
app.store.find('discussions', m.route.param('id'), params).then(this.setupDiscussion.bind(this));
|
app.store.find('discussions', m.route.param('id'), params).then(this.setupDiscussion.bind(this));
|
||||||
|
|
||||||
m.redraw();
|
// Trigger a redraw only if we're not already in a computation (e.g. route change)
|
||||||
|
m.startComputation();
|
||||||
|
m.endComputation();
|
||||||
}
|
}
|
||||||
|
|
||||||
params() {
|
params() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user