mirror of
https://github.com/flarum/core.git
synced 2025-07-25 18:51:40 +02:00
PERF: more efficient retaining of posts
This commit is contained in:
@@ -34,25 +34,28 @@ 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() || (() => {
|
||||||
<div>
|
const controls = PostControls.controls(this.props.post, this).toArray();
|
||||||
{controls.length ? Dropdown.component({
|
|
||||||
children: controls,
|
|
||||||
className: 'Post-controls',
|
|
||||||
buttonClassName: 'Button Button--icon Button--flat',
|
|
||||||
menuClassName: 'Dropdown-menu--right'
|
|
||||||
}) : ''}
|
|
||||||
|
|
||||||
{this.content()}
|
return (
|
||||||
</div>
|
<div>
|
||||||
)}
|
{controls.length ? Dropdown.component({
|
||||||
|
children: controls,
|
||||||
|
className: 'Post-controls',
|
||||||
|
buttonClassName: 'Button Button--icon Button--flat',
|
||||||
|
menuClassName: 'Dropdown-menu--right'
|
||||||
|
}) : ''}
|
||||||
|
|
||||||
|
{this.content()}
|
||||||
|
</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