From a7fa7368d9c223400cea9f67bd6645ea428739e3 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 29 Oct 2024 10:38:58 +0100 Subject: [PATCH 1/7] Reset the page every time that a filter gets updated --- .../app/[application]/settings/automations/index.svelte | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/pages/builder/app/[application]/settings/automations/index.svelte b/packages/builder/src/pages/builder/app/[application]/settings/automations/index.svelte index 6518b6cf58..02b063bca8 100644 --- a/packages/builder/src/pages/builder/app/[application]/settings/automations/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/settings/automations/index.svelte @@ -38,8 +38,11 @@ let loaded = false $: app = $appsStore.apps.find(app => $appStore.appId?.includes(app.appId)) $: licensePlan = $auth.user?.license?.plan - $: page = $pageInfo.page - $: fetchLogs(automationId, status, page, timeRange) + + // Reset the page every time that a filter gets updated + $: pageInfo.reset(), automationId, status, timeRange + + $: fetchLogs(automationId, status, $pageInfo.page, timeRange) $: isCloud = $admin.cloud $: chainAutomations = app?.automations?.chainAutomations ?? !isCloud const timeOptions = [ From 70cd255ef02dd2a2eea62d24c5b2ee7417c2e57c Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 29 Oct 2024 10:39:23 +0100 Subject: [PATCH 2/7] Update pro submodule --- packages/pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pro b/packages/pro index f6aebba944..ee0de4f489 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit f6aebba94451ce47bba551926e5ad72bd75f71c6 +Subproject commit ee0de4f489e8530d98a4ed2c3f0f66034c40bc33 From b9b4f88e4a256032d21eed6e92239398b4263c1d Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Tue, 29 Oct 2024 10:23:32 +0000 Subject: [PATCH 3/7] Fix default values when using multi-option column and supplying empty array. --- packages/server/src/api/routes/tests/row.spec.ts | 13 +++++++++++++ packages/server/src/utilities/rowProcessor/index.ts | 8 +++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/server/src/api/routes/tests/row.spec.ts b/packages/server/src/api/routes/tests/row.spec.ts index 66e931d0ab..42c3560b36 100644 --- a/packages/server/src/api/routes/tests/row.spec.ts +++ b/packages/server/src/api/routes/tests/row.spec.ts @@ -763,12 +763,25 @@ describe.each([ expect(row.food).toEqual(["apple", "orange"]) }) + it("creates a new row with a default value when given an empty list", async () => { + const row = await config.api.row.save(table._id!, { food: [] }) + expect(row.food).toEqual(["apple", "orange"]) + }) + it("does not use default value if value specified", async () => { const row = await config.api.row.save(table._id!, { food: ["orange"], }) expect(row.food).toEqual(["orange"]) }) + + it("resets back to its default value when empty", async () => { + let row = await config.api.row.save(table._id!, { + food: ["orange"], + }) + row = await config.api.row.save(table._id!, { ...row, food: [] }) + expect(row.food).toEqual(["apple", "orange"]) + }) }) describe("user column", () => { diff --git a/packages/server/src/utilities/rowProcessor/index.ts b/packages/server/src/utilities/rowProcessor/index.ts index 0ffa7600aa..d5cbbd2b64 100644 --- a/packages/server/src/utilities/rowProcessor/index.ts +++ b/packages/server/src/utilities/rowProcessor/index.ts @@ -20,6 +20,7 @@ import { User, ViewV2, FeatureFlag, + Document, } from "@budibase/types" import { cloneDeep } from "lodash/fp" import { @@ -134,7 +135,12 @@ async function processDefaultValues(table: Table, row: Row) { } for (const [key, schema] of Object.entries(table.schema)) { - if ("default" in schema && schema.default != null && row[key] == null) { + const isEmpty = + row[key] == null || + row[key] === "" || + (Array.isArray(row[key]) && row[key].length === 0) + + if ("default" in schema && schema.default != null && isEmpty) { let processed: string | string[] if (Array.isArray(schema.default)) { processed = schema.default.map(val => processStringSync(val, ctx)) From 0c8590be9c43a4ecdda68bad35746378b9c1529b Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Tue, 29 Oct 2024 10:32:49 +0000 Subject: [PATCH 4/7] Fix lint. --- packages/server/src/utilities/rowProcessor/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/server/src/utilities/rowProcessor/index.ts b/packages/server/src/utilities/rowProcessor/index.ts index d5cbbd2b64..ed74394a85 100644 --- a/packages/server/src/utilities/rowProcessor/index.ts +++ b/packages/server/src/utilities/rowProcessor/index.ts @@ -20,7 +20,6 @@ import { User, ViewV2, FeatureFlag, - Document, } from "@budibase/types" import { cloneDeep } from "lodash/fp" import { From 4a91b86278628a5d4ac94b448675c32bf9d60ff9 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 29 Oct 2024 11:55:49 +0100 Subject: [PATCH 5/7] Extract values from store --- .../app/[application]/settings/automations/index.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/pages/builder/app/[application]/settings/automations/index.svelte b/packages/builder/src/pages/builder/app/[application]/settings/automations/index.svelte index 02b063bca8..dd332c92a9 100644 --- a/packages/builder/src/pages/builder/app/[application]/settings/automations/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/settings/automations/index.svelte @@ -42,7 +42,8 @@ // Reset the page every time that a filter gets updated $: pageInfo.reset(), automationId, status, timeRange - $: fetchLogs(automationId, status, $pageInfo.page, timeRange) + $: page = $pageInfo.page + $: fetchLogs(automationId, status, page, timeRange) $: isCloud = $admin.cloud $: chainAutomations = app?.automations?.chainAutomations ?? !isCloud const timeOptions = [ From bbab4d35c3b208d9fc250918403da78cc69bc0c4 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 29 Oct 2024 11:55:56 +0100 Subject: [PATCH 6/7] Update pro submodule --- packages/pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pro b/packages/pro index ee0de4f489..a3a06b0aaf 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit ee0de4f489e8530d98a4ed2c3f0f66034c40bc33 +Subproject commit a3a06b0aaff47a341c877fe270ee5b524b99910c From ffdd46ef1d51e7fec0c9b48817574acd95fc4ee0 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 29 Oct 2024 12:00:54 +0100 Subject: [PATCH 7/7] Update pro submodule --- packages/pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pro b/packages/pro index a3a06b0aaf..2ab8536b60 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit a3a06b0aaff47a341c877fe270ee5b524b99910c +Subproject commit 2ab8536b6005576684810d774f1ac22239218546