Skip to content

Commit

Permalink
Fix issue with integers passed through expert mode as a string (Issue #…
Browse files Browse the repository at this point in the history
…5718, PR #5722)

# Description

* Short description here *

closes #5718

# Self Check:

Strike through any lines that are not applicable (`~~line~~`) then check the box

- [x] Attached issue to pull request
- [x] Changelog entry
- [x] Code is clear and sufficiently documented
- [x] Sufficient test cases (reproduces the bug/tests the requested feature)
- [x] Correct, in line with design
- [ ] End user documentation is included or an issue is created for end-user documentation (add ref to issue here: )
  • Loading branch information
matborowczyk authored and inmantaci committed Apr 30, 2024
1 parent 701ea28 commit 0e77e64
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions changelogs/unreleased/5718-expert-mode-fix.yml.yml
Original file line number Diff line number Diff line change
@@ -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}}"
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ test.each`
target: "parent",
value: {
id: "09042sev-1235-f234-ktgd-cc45615ba782",
editedValue: newValue,
editedValue: expectedValue,
unedited: "value",
},
},
Expand Down
7 changes: 5 additions & 2 deletions src/UI/Components/TreeTable/TreeRow/CellWithCopyExpert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,21 @@ export const CellWithCopyExpert: React.FC<Props> = ({

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(
newValue as object,
path.split("$").slice(1).join("."),
formattedAttr,
);
} else {
newValue = formattedAttr;
}

const result = await trigger(
Expand Down

0 comments on commit 0e77e64

Please sign in to comment.