From f51425481724f7b999cdabb9305e4eecd333db15 Mon Sep 17 00:00:00 2001 From: Steven Bal Date: Mon, 11 Nov 2024 12:52:21 +0100 Subject: [PATCH] :bug: [open-formulieren/open-forms#4772] Set select dataType to string because Select components did not have a dataType set, formio tries to cast it to other types if possible, which causes issues when submitting the data to the backend. For that reason we set the value to string to avoid this unwanted normalization --- package-lock.json | 14 +++++++------- package.json | 2 +- src/components/ComponentConfiguration.stories.tsx | 2 ++ src/registry/select/edit.tsx | 1 + 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6234776a..f75f3480 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,7 +39,7 @@ "@formatjs/cli": "^6.1.1", "@formatjs/ts-transformer": "^3.12.0", "@fortawesome/fontawesome-free": "^6.4.0", - "@open-formulieren/types": "^0.33.0", + "@open-formulieren/types": "^0.34.0", "@storybook/addon-actions": "^8.3.5", "@storybook/addon-essentials": "^8.3.5", "@storybook/addon-interactions": "^8.3.5", @@ -5087,9 +5087,9 @@ } }, "node_modules/@open-formulieren/types": { - "version": "0.33.0", - "resolved": "https://registry.npmjs.org/@open-formulieren/types/-/types-0.33.0.tgz", - "integrity": "sha512-ALPg3wMviAxmfdXBBfaSkecZH92yfbH+EXUiyByiDo8WtJHGbniiXSV6YHMWvrXFWuKxCTx22St0wl/if0Ojjw==", + "version": "0.34.0", + "resolved": "https://registry.npmjs.org/@open-formulieren/types/-/types-0.34.0.tgz", + "integrity": "sha512-4MGJdllKYqcKMNRvJSTn+wIu8v0LB1dxfYNK5CV+6y751GN/Ss8sbEbfO69nYvO92zFs1b3NgQ63I6pQC8THMg==", "dev": true, "license": "EUPL-1.2" }, @@ -24607,9 +24607,9 @@ } }, "@open-formulieren/types": { - "version": "0.33.0", - "resolved": "https://registry.npmjs.org/@open-formulieren/types/-/types-0.33.0.tgz", - "integrity": "sha512-ALPg3wMviAxmfdXBBfaSkecZH92yfbH+EXUiyByiDo8WtJHGbniiXSV6YHMWvrXFWuKxCTx22St0wl/if0Ojjw==", + "version": "0.34.0", + "resolved": "https://registry.npmjs.org/@open-formulieren/types/-/types-0.34.0.tgz", + "integrity": "sha512-4MGJdllKYqcKMNRvJSTn+wIu8v0LB1dxfYNK5CV+6y751GN/Ss8sbEbfO69nYvO92zFs1b3NgQ63I6pQC8THMg==", "dev": true }, "@pkgjs/parseargs": { diff --git a/package.json b/package.json index 38cb9efa..d4272d79 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "@formatjs/cli": "^6.1.1", "@formatjs/ts-transformer": "^3.12.0", "@fortawesome/fontawesome-free": "^6.4.0", - "@open-formulieren/types": "^0.33.0", + "@open-formulieren/types": "^0.34.0", "@storybook/addon-actions": "^8.3.5", "@storybook/addon-essentials": "^8.3.5", "@storybook/addon-interactions": "^8.3.5", diff --git a/src/components/ComponentConfiguration.stories.tsx b/src/components/ComponentConfiguration.stories.tsx index 8f4b43d2..5e930ef4 100644 --- a/src/components/ComponentConfiguration.stories.tsx +++ b/src/components/ComponentConfiguration.stories.tsx @@ -1626,6 +1626,7 @@ export const Select: Story = { clearOnHide: true, isSensitiveData: false, dataSrc: 'values', + dataType: 'string', data: { values: [ { @@ -1726,6 +1727,7 @@ export const Select: Story = { clearOnHide: true, isSensitiveData: false, dataSrc: 'values', + dataType: 'string', data: {}, openForms: { dataSrc: 'variable', diff --git a/src/registry/select/edit.tsx b/src/registry/select/edit.tsx index 388b0f08..e52c98a6 100644 --- a/src/registry/select/edit.tsx +++ b/src/registry/select/edit.tsx @@ -177,6 +177,7 @@ EditForm.defaultValues = { // fixed, this is what itemsExpression results in via the backend. Do not confuse with // openForms.dataSrc! dataSrc: 'values', + dataType: 'string', data: {values: [{value: '', label: ''}]}, // TODO: at some point we can allow an itemsExpression for this too // Note: Formio will override this to `null`! So be careful when dealing with