From 70785df37e0be31ef3301af110a7c1475a8f7051 Mon Sep 17 00:00:00 2001 From: Wadim Kalmykov <36057469+w-4@users.noreply.github.com> Date: Tue, 6 Oct 2020 22:52:05 +0700 Subject: [PATCH] SubtreeRetainer: fix onbeforeupdate needsRebuild (#2365) --- framework/core/js/src/common/utils/SubtreeRetainer.js | 5 +++++ 1 file changed, 5 insertions(+) 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(); } /**