-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[HOLD for payment 2023-11-22] [HOLD for payment 2023-11-21] [$500] IOU-In employee WS, in manual request, description entered is not saved in description page #31230
Comments
Triggered auto assignment to @zanyrenney ( |
Job added to Upwork: https://www.upwork.com/jobs/~01f13c7e52024929d1 |
Bug0 Triage Checklist (Main S/O)
|
Triggered auto assignment to Contributor-plus team member for initial proposal review - @narefyev91 ( |
This is another regression from #28866, changes in We render the edit description form twice, the first time with App/src/components/Form/FormProvider.js Lines 214 to 217 in 7f44418
|
ProposalPlease re-state the problem that we are trying to solve in this issue.IOU-In employee WS, in manual request, description entered is not saved in description page What is the root cause of that problem?The The description value is extracted from App/src/components/Form/FormProvider.js Lines 212 to 220 in f0fb7a8
What changes do you think we should make in order to solve the problem?The registerInput method receives in the second parameter the object Use the
|
<View style={styles.mb4}> | |
<InputWrapperWithRef | |
// Comment field does not have its modified counterpart | |
InputComponent={TextInput} | |
inputID="comment" | |
name="comment" | |
defaultValue={defaultDescription} | |
label={translate('moneyRequestConfirmationList.whatsItFor')} | |
accessibilityLabel={translate('moneyRequestConfirmationList.whatsItFor')} | |
role={CONST.ACCESSIBILITY_ROLE.TEXT} | |
ref={(el) => { | |
if (!el) { | |
return; | |
} | |
descriptionInputRef.current = el; | |
updateMultilineInputRange(descriptionInputRef.current); | |
}} | |
autoGrowHeight | |
containerStyles={[styles.autoGrowHeightMultilineInput]} | |
inputStyle={[styles.verticalAlignTop]} | |
submitOnEnter={!Browser.isMobile()} | |
/> | |
</View> |
For example,
<InputWrapperWithRef
// Comment field does not have its modified counterpart
InputComponent={TextInput}
inputID="comment"
name="comment"
defaultValue={defaultDescription}
shouldUseDefaultValue // <- Here we should pass the property
label={translate('moneyRequestConfirmationList.whatsItFor')}
accessibilityLabel={translate('moneyRequestConfirmationList.whatsItFor')}
role={CONST.ACCESSIBILITY_ROLE.TEXT}
ref={(el) => {
if (!el) {
return;
}
descriptionInputRef.current = el;
updateMultilineInputRange(descriptionInputRef.current);
}}
autoGrowHeight
containerStyles={[styles.autoGrowHeightMultilineInput]}
inputStyle={[styles.verticalAlignTop]}
submitOnEnter={!Browser.isMobile()}
/>
As the EditRequestDescriptionPage
component will always receive the defaultDescription
even if the transaction is not available, the field will show the correct value.
Note: I'll try to add some Unit Tests to validate these changes.
Change the registerInput
to use the defaultValue
if this value is not undefined
In the registerInput, when the property shouldUseDefaultValue
is true
we need to add another validation, to ensure the propsToParse.defaultValue
is not undefined.
With this improvement, we can avoid the problem when the propsToParse.defaultValue
is undefined
.
if (!_.isUndefined(propsToParse.value)) {
inputValues[inputID] = propsToParse.value;
} else if (propsToParse.shouldUseDefaultValue && !_.isUndefined(propsToParse.defaultValue)) { // <- Here we need to validate the defaultValue
// We force the form to set the input value from the defaultValue props if there is a saved valid value
inputValues[inputID] = propsToParse.defaultValue;
} else if (_.isUndefined(inputValues[inputID])) {
// We want to initialize the input value if it's undefined
inputValues[inputID] = _.isUndefined(propsToParse.defaultValue) ? getInitialValueByType(propsToParse.valueType) : propsToParse.defaultValue;
}
What alternative solutions did you explore? (Optional)
Changing the registerInput method to set an initial value in the state inputValues[inputID]
when the registerInput
method is called, and doing a refactor removing the first condition.
const registerInput = useCallback(
(inputID, propsToParse = {}) => {
const newRef = inputRefs.current[inputID] || propsToParse.ref || createRef();
if (inputRefs.current[inputID] !== newRef) {
inputRefs.current[inputID] = newRef;
}
inputValues[inputID] = propsToParse.value || propsToParse.defaultValue; // <- Here we should set an initial value for the input state.
if (propsToParse.shouldUseDefaultValue) {
// We force the form to set the input value from the defaultValue props if there is a saved valid value
inputValues[inputID] = propsToParse.defaultValue;
} else if (_.isUndefined(inputValues[inputID])) {
// We want to initialize the input value if it's undefined
inputValues[inputID] = _.isUndefined(propsToParse.defaultValue) ? getInitialValueByType(propsToParse.valueType) : propsToParse.defaultValue;
}
...
);
The result will be the same as the changes I put in the section above, but with this change here, we can avoid adding a new condition to validate if the propsToParse.defaultValue
is undefined
and we have a refactor decreasing the code's complexity.
Note: I'll try to add some Unit Tests to validate these changes.
POC
poc-issue-31230.mov
ProposalPlease re-state the problem that we are trying to solve in this issue.IOU-In employee WS, in manual request, description entered is not saved in description page What is the root cause of that problem?The root cause of the problem is that the What changes do you think we should make in order to solve the problem?To solve the problem, we can add a flag state to the component to indicate if it has been edited by the user. This way, the What alternative solutions did you explore? (Optional)As an alternative solution, we can render the input after the API call is finished. During the loading process, we can display a skeleton loader or simply disable the input. |
📣 @waitingwittykitty! 📣
|
Contributor details |
✅ Contributor details stored successfully. Thank you for contributing to Expensify! |
Issue was fixed based on this reverted PR #31231 |
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results. If a regression has occurred and you are the assigned CM follow the instructions here. If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future. |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.98-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2023-11-21. 🎊 After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
For reference, here are some details about the assignees on this issue:
|
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.99-0 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2023-11-22. 🎊 After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
For reference, here are some details about the assignees on this issue:
|
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
Payment summary: Closing! |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 1.3.98-0
Reproducible in staging?: Y
Reproducible in production?: N
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause-Internal Team
Slack conversation: @
Action Performed:
Expected Result:
In employee WS, in manual request, description entered must be saved in description page.
Actual Result:
In employee WS, in manual request, description entered is not saved in description page.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6272381_1699702645470.des.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: