Repository navigation
[HOLD for payment 2024-10-14] [$250] Custom report name - Delete option is present for Title report field but unable to delete it #49077
Description
Activity
- addedDailyKSv2KSv2BugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.
on Sep 12, 2024 Triggered auto assignment to @dylanexpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.Edited by proposal-police: This proposal was edited at 2024-09-12 13:33:49 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Delete option is present for Title report field but unable to delete it
What is the root cause of that problem?
We should not show Delete option for title field base on this
But the following function not working properly, since we don't use any formula on the Custom name, but instead just a text without formula, the field type will be
text. So it not return true in this function
Lines 2720 to 2722 in 37161bc
function isReportFieldOfTypeTitle(reportField: OnyxEntry<PolicyReportField>): boolean { return reportField?.type === 'formula' && reportField?.fieldID === CONST.REPORT_FIELD_TITLE_FIELD_ID; } What changes do you think we should make in order to solve the problem?
Change the function to the following without checking the type
function isReportFieldOfTypeTitle(reportField: OnyxEntry<PolicyReportField>): boolean { return reportField?.fieldID === CONST.REPORT_FIELD_TITLE_FIELD_ID; }What alternative solutions did you explore? (Optional)
Proposal
Please re-state the problem that we are trying to solve in this issue.
Title report field remains after deleting it.
This issue only happens with Title report field that is enabled by Custom report name.What is the root cause of that problem?
We're showing the policyReportFields from policy and report
App/src/components/ReportActionItem/MoneyReportView.tsx
Lines 70 to 73 in cfe3d36
const sortedPolicyReportFields = useMemo<PolicyReportField[]>((): PolicyReportField[] => { const fields = ReportUtils.getAvailableReportFields(report, Object.values(policy?.fieldList ?? {})); return fields.filter((field) => field.target === report.type).sort(({orderWeight: firstOrderWeight}, {orderWeight: secondOrderWeight}) => firstOrderWeight - secondOrderWeight); }, [policy, report]); Line 2804 in cfe3d36
const mergedFieldIds = Array.from(new Set([...policyReportFields.map(({fieldID}) => fieldID), ...reportFields.map(({fieldID}) => fieldID)])); In this case, there's 1 reportField from policy and no one from report
But when users delete field, we don't clear it in policy (just clear fieldList in report)
App/src/libs/actions/Report.ts
Lines 1992 to 1999 in cfe3d36
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, value: { fieldList: { [fieldKey]: null, }, pendingFields: { [fieldKey]: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE, }, What changes do you think we should make in order to solve the problem?
the reportField from policy shouldn't be deletable
update isReportFieldDeletable
to
const isReportFieldFromReport = !!report?.fieldList?.[fieldKey] const isReportFieldDeletable = reportField.deletable && !isReportFieldTitle && isReportFieldFromReportor we can just check
isReportFieldDeletable = reportField.deletable && reportField?.fieldID !== CONST.REPORT_FIELD_TITLE_FIELD_IDIf we remove
reportField?.type === 'formula'inisReportFieldOfTypeTitlefunction, it can affected a lot of placesWhat alternative solutions did you explore? (Optional)
@dylanexpensify Eep! 4 days overdue now. Issues have feelings too...
reviewing today!
@dylanexpensify Eep! 4 days overdue now. Issues have feelings too...
@dylanexpensify should we open this issue?
- addedExternalAdded to denote the issue can be worked on by a contributorAdded to denote the issue can be worked on by a contributor
on Sep 25, 2024 Job added to Upwork: https://www.upwork.com/jobs/~021838887364204259850
28 remaining items
- addedWeeklyKSv2KSv2Awaiting PaymentAuto-added when associated PR is deployed to productionAuto-added when associated PR is deployed to production
on Oct 7, 2024 - changed the title
[-][$250] Custom report name - Delete option is present for Title report field but unable to delete it[/-][+][HOLD for payment 2024-10-14] [$250] Custom report name - Delete option is present for Title report field but unable to delete it[/+]on Oct 7, 2024 Reviewinglabel has been removed, please complete the "BugZero Checklist".The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.45-4 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 2024-10-14. 🎊
For reference, here are some details about the assignees on this issue:
- @c3024 requires payment automatic offer (Reviewer)
- @daledah requires payment (Needs manual offer from BZ)
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:
- [@c3024] The PR that introduced the bug has been identified. Link to the PR:
- [@c3024] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
- [@c3024] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
- [@c3024] Determine if we should create a regression test for this bug.
- [@c3024] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
- [@dylanexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
Coming up!
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:
- [@c3024] The PR that introduced the bug has been identified. Link to the PR: feat: add delete option to deletable report fields #36039
- [@c3024] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: https://github.com/Expensify/App/pull/36039/files#r1800964733
- [@c3024] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: No discussion was started because this could not have been identified earlier.
- [@c3024] Determine if we should create a regression test for this bug. Yes
- [@c3024] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
Regression Test Proposal
- Go to Workspace Rules -> Enable Custom report name.
- Clear default custom name value and save a text value in the field
- Go to Workspace Chat -> Submit an expense
- Go to this expense report just submitted -> Click on the Title Report Field
- Verify that either
-- there is no three dot menu in the right hand modal
(or)
-- if there is a three dot menu in the right hand modal, there is no Delete option in it.
@daledah sent offer!
Reacted by daledahDone!
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.0.33-1
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers): applausetester+kh010901@applause.expensifail.com
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team
Action Performed:
Expected Result:
The Title report field should disappear after deleting it.
Actual Result:
Title report field remains after deleting it.
This issue only happens with Title report field that is enabled by Custom report name.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Bug6600629_1726120210498.20240912_134544.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @dylanexpensify