Skip to content

Commit

Permalink
Merge pull request #1039 from aehrc/issue/1036
Browse files Browse the repository at this point in the history
Fix checkbox open label string input
  • Loading branch information
fongsean authored Oct 17, 2024
2 parents f4c4ca3 + 2d66fcc commit 68e0424
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ This log documents significant changes for the [@aehrc/smart-forms-renderer](htt

Changelog only includes changes from version 0.36.0 onwards.

## [0.44.2] - 2024-10-18
### Fixed
- Fixed an issue where inputs in checkbox open-choice's open label field does not update the QuestionnaireResponse.

## [0.44.1] - 2024-10-14
### Fixed
Expand Down
2 changes: 1 addition & 1 deletion apps/smart-forms-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"dependencies": {
"@aehrc/sdc-assemble": "^1.3.1",
"@aehrc/sdc-populate": "^2.3.1",
"@aehrc/smart-forms-renderer": "^0.44.1",
"@aehrc/smart-forms-renderer": "^0.44.2",
"@emotion/react": "^11.13.0",
"@emotion/styled": "^11.13.0",
"@fontsource/material-icons": "^5.0.18",
Expand Down
2 changes: 1 addition & 1 deletion documentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"typecheck": "tsc"
},
"dependencies": {
"@aehrc/smart-forms-renderer": "^0.44.1",
"@aehrc/smart-forms-renderer": "^0.44.2",
"@docusaurus/core": "^3.4.0",
"@docusaurus/preset-classic": "^3.4.0",
"@docusaurus/theme-live-codeblock": "^3.4.0",
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/smart-forms-renderer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aehrc/smart-forms-renderer",
"version": "0.44.1",
"version": "0.44.2",
"description": "FHIR Structured Data Captured (SDC) rendering engine for Smart Forms",
"main": "lib/index.js",
"scripts": {
Expand Down
15 changes: 13 additions & 2 deletions packages/smart-forms-renderer/src/utils/openChoice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,21 @@ export function updateOpenLabelAnswer(
}

// New open label answer is different from old open label answer, update it
oldOpenLabelAnswer.valueString = changedOpenLabelValue;
const updatedAnswers = oldQrItem.answer?.map((answer) => {
const { valueString } = answer;
if (valueString === oldOpenLabelAnswer.valueString) {
return {
...answer,
valueString: changedOpenLabelValue // Update the valueString
};
}

return answer; // Keep the other answers unchanged
});

return {
...oldQrItem,
answer: oldQrItem.answer
answer: updatedAnswers
};
}

Expand Down

0 comments on commit 68e0424

Please sign in to comment.