-
Notifications
You must be signed in to change notification settings - Fork 24
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
fix: [DHIS2-14938] trigger error on complete #3594
Conversation
@@ -235,7 +235,7 @@ const getSaveHandler = ( | |||
} = this.props; | |||
|
|||
const filteredProps = onFilterProps ? onFilterProps(passOnProps) : passOnProps; | |||
this.isCompleting = !!(onIsCompleting && onIsCompleting(this.props)); | |||
this.isCompleting = Boolean(onIsCompleting && onIsCompleting(this.props) === 'true'); |
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.
Can we change the edit event code instead of the generic withSaveHandler component? here:
Line 360 in dbc1051
onIsCompleting: (props: Object) => props.completeDataEntryFieldValue, |
I think it makes sense to keep the return value of onIsCompleting a boolean value.
filter((action) => { | ||
const { | ||
meta: { triggerAction }, | ||
} = action; | ||
return ( | ||
triggerAction === enrollmentSiteActionTypes.COMMIT_ENROLLMENT_EVENT || | ||
triggerAction === enrollmentEditEventActionTypes.EVENT_SAVE_ENROLLMENT_COMPLETE_SUCCESS | ||
); | ||
}), |
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.
Is this really needed? Seems like we return EMPTY on line 183. Is it good enough to do one or the other?
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.
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 the reason EMPTY
crashes the app is that it counts as an observable and not an action; so it works as return value for switchMap
but not for map
. I think using filter
is the best solution here. I approve the last commit 👍
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 see, thanks. Current PR looks good to me.
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.
LGTM
🚀 Deployed on https://deploy-preview-3594--dhis2-capture.netlify.app |
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.
Tested successfully on 2.42,2.41.0,2.40.4,2.39.6,2.38.7 versions
🎉 This PR is included in version 100.67.12 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
DHIS2-14938
Tech summary:
The
completeDataEntryFieldValue
prop can take different values (i.e.,undefined
,null
,'true'
,'false'
). The values come from the redux store keydataEntriesFieldsValue
which is initialized and handled differently by different forms. I fixed the edit event code to return the value ofonIsCompleting
a boolean value.