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..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 @@ -38,6 +38,10 @@ let loaded = false $: app = $appsStore.apps.find(app => $appStore.appId?.includes(app.appId)) $: licensePlan = $auth.user?.license?.plan + + // Reset the page every time that a filter gets updated + $: pageInfo.reset(), automationId, status, timeRange + $: page = $pageInfo.page $: fetchLogs(automationId, status, page, timeRange) $: isCloud = $admin.cloud diff --git a/packages/pro b/packages/pro index f6aebba944..2ab8536b60 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit f6aebba94451ce47bba551926e5ad72bd75f71c6 +Subproject commit 2ab8536b6005576684810d774f1ac22239218546 diff --git a/packages/server/src/api/routes/tests/row.spec.ts b/packages/server/src/api/routes/tests/row.spec.ts index 2980803fbc..526e4b7a79 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..ed74394a85 100644 --- a/packages/server/src/utilities/rowProcessor/index.ts +++ b/packages/server/src/utilities/rowProcessor/index.ts @@ -134,7 +134,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))