diff --git a/changelogs/unreleased/5718-expert-mode-fix.yml.yml b/changelogs/unreleased/5718-expert-mode-fix.yml.yml new file mode 100644 index 000000000..0f26c4c5a --- /dev/null +++ b/changelogs/unreleased/5718-expert-mode-fix.yml.yml @@ -0,0 +1,6 @@ +description: "Fix issue with integers passed through expert mode as a string" +issue-nr: 5718 +change-type: patch +destination-branches: [master, iso7] +sections: + bugfix: "{{description}}" diff --git a/src/UI/Components/TreeTable/TreeRow/CellWithCopyExpert.test.tsx b/src/UI/Components/TreeTable/TreeRow/CellWithCopyExpert.test.tsx index 0e5eb6777..834f4c93e 100644 --- a/src/UI/Components/TreeTable/TreeRow/CellWithCopyExpert.test.tsx +++ b/src/UI/Components/TreeTable/TreeRow/CellWithCopyExpert.test.tsx @@ -543,7 +543,7 @@ test.each` target: "parent", value: { id: "09042sev-1235-f234-ktgd-cc45615ba782", - editedValue: newValue, + editedValue: expectedValue, unedited: "value", }, }, diff --git a/src/UI/Components/TreeTable/TreeRow/CellWithCopyExpert.tsx b/src/UI/Components/TreeTable/TreeRow/CellWithCopyExpert.tsx index 6dcd3d90b..a3ea92766 100644 --- a/src/UI/Components/TreeTable/TreeRow/CellWithCopyExpert.tsx +++ b/src/UI/Components/TreeTable/TreeRow/CellWithCopyExpert.tsx @@ -99,11 +99,12 @@ export const CellWithCopyExpert: React.FC = ({ if (attributeType.includes("int")) { const tempFormat = parseInt(newAttribute as unknown as string); - formattedAttr = isNaN(tempFormat) ? tempFormat : newAttribute; + formattedAttr = isNaN(tempFormat) ? newAttribute : tempFormat; } else if (attributeType.includes("float")) { const tempFormat = parseFloat(newAttribute as unknown as string); - formattedAttr = isNaN(tempFormat) ? tempFormat : newAttribute; + formattedAttr = isNaN(tempFormat) ? newAttribute : tempFormat; } + if (parentObject) { newValue = parentObject[path.split("$")[0]]; set( @@ -111,6 +112,8 @@ export const CellWithCopyExpert: React.FC = ({ path.split("$").slice(1).join("."), formattedAttr, ); + } else { + newValue = formattedAttr; } const result = await trigger(