-
Notifications
You must be signed in to change notification settings - Fork 99
(fix) O3-4581: Reset the rendering type when the question type changes #426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
(fix) O3-4581: Reset the rendering type when the question type changes #426
Conversation
Added logic to remove rendering type value if the previously selected rendering type value is not present for the new question type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @yoursanonymous , I noticed that the code directly mutates the formField object using the delete operator.
Instead, I would suggest to create a new object without the questionOptions property when needed. This way, the state updates cleanly and predictably.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @yoursanonymous, please include a screen recording of before and after the fix
...components/interactive-builder/modals/question/question-form/question/question.component.tsx
Outdated
Show resolved
Hide resolved
1. Added a separate function to handle formField change 2. Removed directly deleting line to avoid directly mutating the formField object
we can see that the rendering type was automatically selected as the first dropdown value before.mp4now we can see that it is asking us to choose a rendering type instead of automatically selecting first drop down value after we changed the question type after.mp4 |
...components/interactive-builder/modals/question/question-form/question/question.component.tsx
Outdated
Show resolved
Hide resolved
...components/interactive-builder/modals/question/question-form/question/question.component.tsx
Outdated
Show resolved
Hide resolved
...components/interactive-builder/modals/question/question-form/question/question.component.tsx
Outdated
Show resolved
Hide resolved
...components/interactive-builder/modals/question/question-form/question/question.component.tsx
Outdated
Show resolved
Hide resolved
Hi @NethmiRodrigo , Thankyou for approving my PR, |
Added logic to remove rendering type value if the previously selected rendering type value is not present for the new question type
Requirements
Summary
Rendering type was same even after changing the Question type and in UI it selects the 1st dropdown value if previous selected rendering type is not available
Screenshots
Related Issue
https://openmrs.atlassian.net/browse/O3-4581
Other