diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index 5997c69151..5148afd13c 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -1246,6 +1246,16 @@ export const getFrontendStore = () => { const settings = getComponentSettings(component._component) const updatedSetting = settings.find(setting => setting.key === name) + const resetFields = settings.filter( + setting => name === setting.resetOn + ) + resetFields?.forEach(setting => { + console.log(setting.key, component) + if (component[setting.key]) { + component[setting.key] = null + } + }) + if ( updatedSetting?.type === "dataSource" || updatedSetting?.type === "table" diff --git a/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldConfiguration.svelte b/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldConfiguration.svelte index f12e8d27ae..e41b41642b 100644 --- a/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldConfiguration.svelte +++ b/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldConfiguration.svelte @@ -34,9 +34,10 @@ } $: datasource = getDatasourceForProvider($currentAsset, componentInstance) + $: resourceId = datasource.resourceId || datasource.tableId - $: if (!isEqual(value, cachedValue)) { - cachedValue = value + $: if (!isEqual(value, cachedValue) || resourceId) { + cachedValue = cloneDeep(value) schema = getSchema($currentAsset, datasource) } diff --git a/packages/client/manifest.json b/packages/client/manifest.json index 015d32ce2d..d91a71853e 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -4745,7 +4745,8 @@ "dependsOn": { "setting": "clickBehaviour", "value": "details" - } + }, + "resetOn": "dataSource" }, { "label": "Save button", @@ -5397,6 +5398,7 @@ "type": "fieldConfiguration", "key": "fields", "nested": true, + "resetOn": "dataSource", "selectAllFields": true }, { diff --git a/packages/client/src/components/app/blocks/form/InnerFormBlock.svelte b/packages/client/src/components/app/blocks/form/InnerFormBlock.svelte index bca6c21cdb..f2887e97ad 100644 --- a/packages/client/src/components/app/blocks/form/InnerFormBlock.svelte +++ b/packages/client/src/components/app/blocks/form/InnerFormBlock.svelte @@ -211,17 +211,19 @@ {/if} {/if} - - {#each fields as field, idx} - {#if getComponentForField(field) && field.active} - - {/if} - {/each} - + {#key fields} + + {#each fields as field, idx} + {#if getComponentForField(field) && field.active} + + {/if} + {/each} + + {/key} {:else}