From 0a12089a54fcad1b6270a7174693c38987746463 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() } }) }