1
0
mirror of https://github.com/flarum/core.git synced 2025-08-11 19:04:29 +02:00

infrastructure: For SubtreeRetainer, return a boolean, not a vnode, as subtree retaining is now managed by onbeforeupdate

This commit is contained in:
Alexander Skvortsov
2020-08-08 12:04:09 -04:00
committed by Franz Liedke
parent 29af3e6d8b
commit 9793c10610

View File

@@ -14,7 +14,7 @@
* // view
* this.subtree.retain() || 'expensive expression'
*
* @see https://lhorie.github.io/mithril/mithril.html#persisting-dom-elements-across-route-changes
* @see https://mithril.js.org/lifecycle-methods.html#onbeforeupdate
*/
export default class SubtreeRetainer {
/**
@@ -32,7 +32,7 @@ export default class SubtreeRetainer {
* @return {Object|false}
* @public
*/
retain() {
needsRebuild() {
let needsRebuild = false;
this.callbacks.forEach((callback, i) => {
@@ -44,7 +44,7 @@ export default class SubtreeRetainer {
}
});
return needsRebuild ? false : { subtree: 'retain' };
return needsRebuild;
}
/**