From 63692f12c5c8c37086d6f8b5db982fb777b3d9f7 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) --- js/src/common/utils/SubtreeRetainer.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/src/common/utils/SubtreeRetainer.js b/js/src/common/utils/SubtreeRetainer.js index 35c550a75..5b042ccf8 100644 --- a/js/src/common/utils/SubtreeRetainer.js +++ b/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(); } /**