-
Notifications
You must be signed in to change notification settings - Fork 1
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
MPDX-8383 - Complete Task Modal - preselect result #1148
Conversation
Preview branch generated at https://MPDX-8383-preselect-single-task.d3dytjb8adxkk5.amplifyapp.com |
Bundle sizes [mpdx-react]Compared against 0162a33 No significant changes found |
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.
This is great! Thank you for fixing it so fast!
src/components/Task/Modal/Form/Inputs/ResultAutocomplete/ResultAutocomplete.test.tsx
Outdated
Show resolved
Hide resolved
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.
I don't think this is quite right. It shows the correct value in the UI but doesn't seem to actually select it because displayResult
is being sent as null
.
It also isn't showing the Next Action autocomplete.
@canac good catch, what about something like this. I'm sure there's a better way but I can't think of anything at the moment. |
@wjames111 Yeah, I think that's exactly what you'll want to do. |
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.
Almost there!
expect(getByRole('combobox', { name: 'Result' })).toBeInTheDocument(); | ||
expect(getByRole('combobox', { name: 'Result' })).toHaveValue('Attempted'); |
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.
The getByRole
for the value check is enough to also assert that it is in the document.
expect(getByRole('combobox', { name: 'Result' })).toBeInTheDocument(); | |
expect(getByRole('combobox', { name: 'Result' })).toHaveValue('Attempted'); | |
expect(getByRole('combobox', { name: 'Result' })).toHaveValue('Attempted'); |
@@ -63,7 +63,7 @@ export const handleTaskPhaseChange = ({ | |||
setFieldValue('taskPhase', phase); | |||
setFieldValue('activityType', ''); | |||
setFieldValue('subject', ''); | |||
setFieldValue('displayResult', undefined); | |||
setFieldValue('displayResult', ''); |
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.
I think this change is causing an error when I try to add or edit a task:
Variable $attributes of type TaskUpdateInput! was provided invalid value for displayResult (Expected "" to be one of: INITIATION_RESULT_NO_RESPONSE, INITIATION_RESULT_CIRCLE_BACK, INITIATION_RESULT_APPOINTMENT_SCHEDULED, INITIATION_RESULT_NOT_INTERESTED, FOLLOW_UP_RESULT_NO_RESPONSE, FOLLOW_UP_RESULT_PARTNER_FINANCIAL, FOLLOW_UP_RESULT_PARTNER_SPECIAL, FOLLOW_UP_RESULT_PARTNER_PRAY, FOLLOW_UP_RESULT_NOT_INTERESTED, APPOINTMENT_RESULT_CANCELLED, APPOINTMENT_RESULT_FOLLOW_UP, APPOINTMENT_RESULT_PARTNER_FINANCIAL, APPOINTMENT_RESULT_PARTNER_SPECIAL, APPOINTMENT_RESULT_PARTNER_PRAY, APPOINTMENT_RESULT_NOT_INTERESTED, PARTNER_CARE_COMPLETED)
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.
So for some reason leaving it as undefined breaks it and I can't quite figure out why.
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.
Specifically on Log Task.
…tAutocomplete.test.tsx Co-authored-by: Bizz (Daniel Bisgrove) <[email protected]>
c4d6631
to
3dff50e
Compare
@wjames111 I think we can fix the bug where the result is populated before the user picks an action by passing an empty array to Sorry, I thought you had requested another review. I'm sure you were going to get to that bug, but I'm just mentioning what I found since I already spent the time looking at the code. The rest looks great once you get all the tests passing again! diff --git a/src/components/Task/Modal/Form/Complete/TaskModalCompleteForm.tsx b/src/components/Task/Modal/Form/Complete/TaskModalCompleteForm.tsx
index 7b38566fc..d572c847a 100644
--- a/src/components/Task/Modal/Form/Complete/TaskModalCompleteForm.tsx
+++ b/src/components/Task/Modal/Form/Complete/TaskModalCompleteForm.tsx
@@ -350,7 +350,7 @@ const TaskModalCompleteForm = ({
</Grid>
<ResultAutocomplete
- availableResults={availableResults}
+ availableResults={activityType ? availableResults : []}
result={displayResult}
setFieldValue={setFieldValue}
setResultSelected={setResultSelected}
diff --git a/src/components/Task/Modal/Form/LogForm/TaskModalLogForm.tsx b/src/components/Task/Modal/Form/LogForm/TaskModalLogForm.tsx
index 98babc1e2..fcf96c4e4 100644
--- a/src/components/Task/Modal/Form/LogForm/TaskModalLogForm.tsx
+++ b/src/components/Task/Modal/Form/LogForm/TaskModalLogForm.tsx
@@ -421,7 +421,7 @@ const TaskModalLogForm = ({
)}
<ResultAutocomplete
- availableResults={availableResults}
+ availableResults={activityType ? availableResults : []}
result={displayResult}
setFieldValue={setFieldValue}
setResultSelected={setResultSelected}
diff --git a/src/components/Task/Modal/Form/TaskModalForm.tsx b/src/components/Task/Modal/Form/TaskModalForm.tsx
index fbf817d9b..aa4920862 100644
--- a/src/components/Task/Modal/Form/TaskModalForm.tsx
+++ b/src/components/Task/Modal/Form/TaskModalForm.tsx
@@ -583,7 +583,7 @@ const TaskModalForm = ({
</Grid>
{initialTask.completedAt && (
<ResultAutocomplete
- availableResults={availableResults}
+ availableResults={activityType ? availableResults : []}
result={displayResult}
setFieldValue={setFieldValue}
setResultSelected={setResultSelected} |
@canac sorry didn't mean to request your review yet. But thank you, that is a much easier solution then I was thinking. |
@canac I did notice that the Result autocomplete is hidden while availableResults is empty. Not sure how often users would need to skip down the form but if it's an issue I could just check for the activityType in the useEffect. |
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.
This is great! As a user, I'm looking forward to saving some clicks when I complete tasks!
Description
Checklist: