Disable delivery system edit buttons, unless selected #91
+78
−29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
At the bottom of each measure page is a table of delivery systems, with an Edit button for each row. But users are only required to report on the delivery system(s) they indicated they would report on, in a prior question. This pull request wires up these buttons' enabled/disabled states to that prior question.
In order to make this happen, I added a field called
formKey
to the delivery system selection radio button. Most inputs will have an auto-generated name like"elements.7"
; these radio buttons will now have fixed names. Then I can query React Hook Form by the appropriate name to get the selected delivery system instantly (that is, without waiting for the report to update in the store).I also changed the values of the radio buttons. Whereas previously we had
semantic-kebab-case
values, now the values correspond directly theDeliverySystem
enum - with multiple systems joined by commas if necessary.In the future, we may want to add a
formKey
property to the rest of our elements. I don't love the code I added in Page.tsx to "maybe use the formKey we have, or maybe generate one". I'm not sure how much work would be involved in convincing Typescript that the elements we care about will always have form keys. It's possible that we will be able to remove that code entirely, by restructuring theComposedElement
pattern... somehow. In fact, we may want to do that before merging this PR. I request your opinion, dear reviewer.Related ticket(s)
CMDCT-4182
How to test
Important updates
Note that these changes are not backwards-compatible with existing reports, because of the changes I made to
qms.ts
Author checklist
convert to a different template: test → val | val → prod