diff --git a/framework/core/js/src/common/utils/SubtreeRetainer.js b/framework/core/js/src/common/utils/SubtreeRetainer.js index 35c550a75..5b042ccf8 100644 --- a/framework/core/js/src/common/utils/SubtreeRetainer.js +++ b/framework/core/js/src/common/utils/SubtreeRetainer.js @@ -28,6 +28,9 @@ export default class SubtreeRetainer { constructor(...callbacks) { this.callbacks = callbacks; this.data = {}; + // Build the initial data, so it is available when calling + // needsRebuild from the onbeforeupdate hook. + this.needsRebuild(); } /** @@ -60,6 +63,8 @@ export default class SubtreeRetainer { */ check(...callbacks) { this.callbacks = this.callbacks.concat(callbacks); + // Update the data cache when new checks are added. + this.needsRebuild(); } /**