1
0
mirror of https://github.com/flarum/core.git synced 2025-08-06 00:17:31 +02:00

Revert "Use some for needsRebuild in SubtreeRetainer"

This reverts commit 5318bd456856407dd92f44583bed5c88f0813a80.

My bad, I did not realize there was a side effect (storing stuff in
this.data) when suggesting this change. With that, using some() is much
less useful - plus it probably causes a bug because it does not always
iterate over all items once the callback returns true.
This commit is contained in:
Franz Liedke
2020-09-06 22:35:45 +02:00
parent 398951f282
commit a5b2768836

View File

@@ -33,16 +33,18 @@ export default class SubtreeRetainer {
* @public * @public
*/ */
needsRebuild() { needsRebuild() {
return this.callbacks.some((callback, i) => { let needsRebuild = false;
this.callbacks.forEach((callback, i) => {
const result = callback(); const result = callback();
if (result !== this.data[i]) { if (result !== this.data[i]) {
this.data[i] = result; this.data[i] = result;
return true; needsRebuild = true;
} }
return false;
}); });
return needsRebuild;
} }
/** /**