From 710397c46b66288f5276193219b6699271eeb88d Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 7 Dec 2023 10:47:45 +0000 Subject: [PATCH] Fix updates being skipped due to erroneous use of 'skip update' flags --- packages/builder/src/builderStore/store/frontend.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index 7e510c3d26..fb10965b41 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -112,7 +112,7 @@ export const getFrontendStore = () => { } let clone = cloneDeep(screen) const result = patchFn(clone) - + // An explicit false result means skip this change if (result === false) { return } @@ -879,11 +879,14 @@ export const getFrontendStore = () => { } // Mutates the fetched component with updates - const updated = patchFn(component, screen) + const patchResult = patchFn(component, screen) + // Mutates the component with any required settings updates const migrated = store.actions.components.migrateSettings(component) - return updated || migrated + // Returning an explicit false signifies that we should skip this + // update. If we migrated something, ensure we never skip. + return migrated ? null : patchResult } await store.actions.screens.patch(patchScreen, screenId) },