Skip to content
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

[$250] Page not found on reload when editing report field with emoji #48771

Closed
1 of 6 tasks
m-natarajan opened this issue Sep 8, 2024 · 18 comments
Closed
1 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@m-natarajan
Copy link

m-natarajan commented Sep 8, 2024

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.30-15
Reproducible in staging?: Yes
Reproducible in production?: Yes
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: @dukenv0307
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1725814149415589

Action Performed:

  1. Create a new workspace
  2. Navigate to Workspace Settings > Enable Report Field.
  3. In Report Field, add a field, name it with emoji
  4. Go to Workspace Chat > Submit an expense
  5. In Expense report, click on the custom report fields
  6. Reload page

Expected Result:

Page is displayed normally

Actual Result:

Page not found is displayed

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

bug.mov
Recording.527.mp4

Add any screenshot/video evidence

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021833943446133965563
  • Upwork Job ID: 1833943446133965563
  • Last Price Increase: 2024-09-18
  • Automatic offers:
    • dukenv0307 | Contributor | 103919553
Issue OwnerCurrent Issue Owner: @s77rt
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 8, 2024
Copy link

melvin-bot bot commented Sep 8, 2024

Triggered auto assignment to @CortneyOfstad (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.

@daledah
Copy link
Contributor

daledah commented Sep 8, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

Page not found on reload when editing report field with emoji

What is the root cause of that problem?

When we reload the page, the fieldKey will be retrieved through the route params here.

const fieldKey = ReportUtils.getReportFieldKey(route.params.fieldID);

Because fieldID is not encoded and decoded here => reportField = undefined => Page Not Found is display

getRoute: (reportID: string, policyID: string, fieldID: string) => `r/${reportID}/edit/policyField/${policyID}/${fieldID}` as const,

What changes do you think we should make in order to solve the problem?

We should use 2 functions encodeURIComponent and decodeURIComponent for fieldID params like we did with many other routes

  1. Update getRoute function with route EDIT_REPORT_FIELD_REQUEST here
getRoute: (reportID: string, policyID: string, fieldID: string) => `r/${reportID}/edit/policyField/${policyID}/${encodeURIComponent(fieldID)}` as const,
  1. Use decodeURIComponent in here to decode fieldID params
[SCREENS.EDIT_REQUEST.REPORT_FIELD]: {
    path: ROUTES.EDIT_REPORT_FIELD_REQUEST.route,
    parse: {
        fieldID: (fieldID: string) => decodeURIComponent(fieldID),
    },
},

What alternative solutions did you explore? (Optional)

In a simpler way, we can use decodeURIComponent function to decode fieldID in component here

const fieldKey = ReportUtils.getReportFieldKey(decodeURIComponent(route.params.fieldID));

@Nodebrute
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

Page not found on reload when editing report field with emoji

What is the root cause of that problem?

We are not using parse decodeURIComponent here

[SCREENS.RIGHT_MODAL.EDIT_REQUEST]: {

What changes do you think we should make in order to solve the problem?

We should use add decodeURIComponent here
Pseudocode

    [SCREENS.RIGHT_MODAL.EDIT_REQUEST]: {
                    screens: {
                        [SCREENS.EDIT_REQUEST.REPORT_FIELD]:{
                            path:ROUTES.EDIT_REPORT_FIELD_REQUEST.route,
                            parse: {
                                fieldID: (fieldID: string) => decodeURIComponent(fieldID),
                            },
                        } 
                    },
                },

We can also add encodeURIComponent here

What alternative solutions did you explore? (Optional)

@dukenv0307
Copy link
Contributor

@CortneyOfstad I report this bug so I can help take it as C+

@bernhardoj
Copy link
Contributor

bernhardoj commented Sep 9, 2024

Edited by proposal-police: This proposal was edited at 2024-09-09 05:36:40 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

Not found is shown when reloading edit report field page.

What is the root cause of that problem?

When we open a report field with an emoji as the ID, rn navigation automatically encodes the emoji, for example, 😄 to %F0%9F%98%84. When EditReportFieldPage component receives the ID param, the value is already decoded to the emoji 😄.

After we refresh the page, the path (%F0%9F%98%84) is encoded again (specifically the %) and becomes %25F0%259F%2598%2584. So, when EditReportFieldPage receives the ID param, the value is %F0%9F%98%84.

And the fieldID here becomes expensify_field_id_%F0%9F%98%84 which doesn't exist.

const fieldKey = ReportUtils.getReportFieldKey(route.params.fieldID);
const reportField = report?.fieldList?.[fieldKey] ?? policy?.fieldList?.[fieldKey];

What changes do you think we should make in order to solve the problem?

We just need to decode the params in the linking config for the edit report field page,

[SCREENS.RIGHT_MODAL.EDIT_REQUEST]: {
screens: {
[SCREENS.EDIT_REQUEST.REPORT_FIELD]: ROUTES.EDIT_REPORT_FIELD_REQUEST.route,
},
},

screens: {
    [SCREENS.EDIT_REQUEST.REPORT_FIELD]: {
        path: ROUTES.EDIT_REPORT_FIELD_REQUEST.route,
        parse: {
            fieldID: (fieldID: string) => decodeURIComponent(fieldID),
        }
    }
},

just like we did with other routes

[SCREENS.WORKSPACE.WORKFLOWS_APPROVALS_EDIT]: {
path: ROUTES.WORKSPACE_WORKFLOWS_APPROVALS_EDIT.route,
parse: {
firstApproverEmail: (firstApproverEmail: string) => decodeURIComponent(firstApproverEmail),
},
},

so internally, the navigator will hold the decoded params and when we refresh the page, 😄 will be encoded to %F0%9F%98%84 instead of %F0%9F%98%84 to %25F0%259F%2598%2584.

@melvin-bot melvin-bot bot added the Overdue label Sep 11, 2024
@CortneyOfstad CortneyOfstad added the External Added to denote the issue can be worked on by a contributor label Sep 11, 2024
@melvin-bot melvin-bot bot changed the title Page not found on reload when editing report field with emoji [$250] Page not found on reload when editing report field with emoji Sep 11, 2024
Copy link

melvin-bot bot commented Sep 11, 2024

Job added to Upwork: https://www.upwork.com/jobs/~021833943446133965563

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 11, 2024
Copy link

melvin-bot bot commented Sep 11, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @s77rt (External)

@melvin-bot melvin-bot bot removed the Overdue label Sep 11, 2024
@CortneyOfstad CortneyOfstad assigned dukenv0307 and unassigned s77rt Sep 11, 2024
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 11, 2024
Copy link

melvin-bot bot commented Sep 11, 2024

📣 @dukenv0307 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@CortneyOfstad CortneyOfstad added the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 11, 2024
@CortneyOfstad
Copy link
Contributor

@s77rt — I re-assigned to @dukenv0307 based on the comment here. Any questions, just let me know!

@dukenv0307
Copy link
Contributor

@daledah's proposal LGTM. He provides the first solution and we have to do both encode and decode. If we just decode in linkingConfig, we will face the problem in case we have fieldID as %F0%9F%98%84

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Sep 12, 2024

Triggered auto assignment to @marcochavezf, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

Copy link

melvin-bot bot commented Sep 17, 2024

@marcochavezf, @CortneyOfstad, @dukenv0307 Huh... This is 4 days overdue. Who can take care of this?

@CortneyOfstad
Copy link
Contributor

@marcochavezf does the proposal and assignment look good for this issue?

@melvin-bot melvin-bot bot removed the Overdue label Sep 17, 2024
Copy link

melvin-bot bot commented Sep 18, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added Overdue and removed Help Wanted Apply this label when an issue is open to proposals by contributors labels Sep 20, 2024
Copy link

melvin-bot bot commented Sep 20, 2024

📣 @daledah You have been assigned to this job!
Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs!
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 Overdue labels Sep 22, 2024
@CortneyOfstad CortneyOfstad added Awaiting Payment Auto-added when associated PR is deployed to production and removed Reviewing Has a PR in review labels Oct 14, 2024
@melvin-bot melvin-bot bot added the Overdue label Oct 14, 2024
@CortneyOfstad
Copy link
Contributor

@daledah — I sent you a payment offer in Upwork. Please let me know once you accept!

@dukenv0307 — paid $250 via Upwork!

@melvin-bot melvin-bot bot removed the Overdue label Oct 14, 2024
@daledah
Copy link
Contributor

daledah commented Oct 14, 2024

Please let me know once you accept!

@CortneyOfstad Thanks for the offer, I accepted

@CortneyOfstad
Copy link
Contributor

Payment Summary

@daledah — paid $250 via Upwork
@dukenv0307 — paid $250 via Upwork

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
No open projects
Status: Done
Development

No branches or pull requests

8 participants