From 6be1e0c8285a4342514f5cf4f621da288b095f17 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 23 Aug 2021 16:39:09 +0100 Subject: [PATCH] Fix issue with memoizing onclick handlers nested inside conditional UI conditions --- packages/client/src/utils/componentProps.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/client/src/utils/componentProps.js b/packages/client/src/utils/componentProps.js index 5472c57308..a181d1ea4d 100644 --- a/packages/client/src/utils/componentProps.js +++ b/packages/client/src/utils/componentProps.js @@ -51,6 +51,12 @@ export const enrichProps = (props, context) => { condition.settingValue, totalContext ) + + // If there is an onclick function in here then it won't be serialised + // properly, and therefore will not be updated properly. + // The solution to this is add a rand which will ensure diffs happen + // every time. + condition.rand = Math.random() } }) }