mirror of
https://github.com/flarum/core.git
synced 2025-07-26 11:10:41 +02:00
PERF: more efficient retaining of posts
This commit is contained in:
@@ -34,14 +34,16 @@ export default class Post extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
view() {
|
view() {
|
||||||
const controls = PostControls.controls(this.props.post, this).toArray();
|
|
||||||
const attrs = this.attrs();
|
const attrs = this.attrs();
|
||||||
|
|
||||||
attrs.className = 'Post ' + (attrs.className || '');
|
attrs.className = 'Post ' + (attrs.className || '');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<article {...attrs}>
|
<article {...attrs}>
|
||||||
{this.subtree.retain() || (
|
{this.subtree.retain() || (() => {
|
||||||
|
const controls = PostControls.controls(this.props.post, this).toArray();
|
||||||
|
|
||||||
|
return (
|
||||||
<div>
|
<div>
|
||||||
{controls.length ? Dropdown.component({
|
{controls.length ? Dropdown.component({
|
||||||
children: controls,
|
children: controls,
|
||||||
@@ -52,7 +54,8 @@ export default class Post extends Component {
|
|||||||
|
|
||||||
{this.content()}
|
{this.content()}
|
||||||
</div>
|
</div>
|
||||||
)}
|
);
|
||||||
|
})()}
|
||||||
</article>
|
</article>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -63,6 +66,7 @@ export default class Post extends Component {
|
|||||||
* @return {Object}
|
* @return {Object}
|
||||||
*/
|
*/
|
||||||
attrs() {
|
attrs() {
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,5 +75,6 @@ export default class Post extends Component {
|
|||||||
* @return {Object}
|
* @return {Object}
|
||||||
*/
|
*/
|
||||||
content() {
|
content() {
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user