Skip to content

[Due for payment 2025-05-22] [$250] Console Errors on Report Debug Page #61702

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

Open
4 of 16 tasks
m-natarajan opened this issue May 8, 2025 · 18 comments
Open
4 of 16 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 May 8, 2025

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:
Reproducible in staging?: Needs Reproduction
Reproducible in production?: Needs Reproduction
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: @tgolen
Slack conversation (hyperlinked to channel name): #Open Source

Action Performed:

  1. Enable debug in trouble shooting
  2. Navigate to "Reports"
  3. Open a Expense report

Expected Result:

The console should be free of errors or unexpected warnings when loading and using the Report Debug page.

Actual Result:

Multiple console errors are present

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop
Platforms Tested: On which of our officially supported platforms was this issue tested:
  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Image

Image

Image

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021920533399339131818
  • Upwork Job ID: 1920533399339131818
  • Last Price Increase: 2025-05-08
Issue OwnerCurrent Issue Owner: @sonialiap
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 8, 2025
Copy link

melvin-bot bot commented May 8, 2025

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

Copy link
Contributor

github-actions bot commented May 8, 2025

⚠️ Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).

@nabi-ebrahimi
Copy link
Contributor

nabi-ebrahimi commented May 8, 2025

🚨 Edited by proposal-police: This proposal was edited at 2025-05-08 16:10:17 UTC.

Proposal

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

The console should be free of errors or unexpected warnings when loading and using the Report Debug page.

What is the root cause of that problem?

There are two problem here

  1. The root cause is that components like ConstantSelector and DateTimeSelector are passed into InputWrapper as InputComponent, but they do not support ref because they are not wrapped in React.forwardRef. here and here

  2. The key prop is not passed to InputWrapper in DebugDetails and a View in DebugReportPage

here

 <View style={[styles.mb5, styles.ph5, styles.gap5]}>
                    {textFields.map(([key, value]) => {
                        const numberOfLines = DebugUtils.getNumberOfLinesFromString((formDraftData?.[key as keyof typeof formDraftData] as string) ?? value);
                        return (
                            <InputWrapper
                          
                                InputComponent={TextInput}
                                inputID={key}
                                accessibilityLabel={key}
                                shouldSaveDraft
                                forceActiveLabel
                                label={key}
                                numberOfLines={numberOfLines}
                                multiline={numberOfLines > 1}
                                defaultValue={value}
                                disabled={DETAILS_DISABLED_KEYS.includes(key)}
                                shouldInterceptSwipe
                            />
                        );
                    })}
                    {textFields.length === 0 && <Text style={[styles.textNormalThemeText, styles.ph5]}>{translate('debug.none')}</Text>}
                </View>

here

<View style={[styles.mb5, styles.ph5, styles.gap5]}>
                    {numberFields.map(([key, value]) => (
                        <InputWrapper
                     
                            InputComponent={TextInput}
                            inputID={key}
                            accessibilityLabel={key}
                            shouldSaveDraft
                            forceActiveLabel
                            label={key}
                            defaultValue={String(value)}
                            disabled={DETAILS_DISABLED_KEYS.includes(key)}
                            shouldInterceptSwipe
                        />
                    ))}
                    {numberFields.length === 0 && <Text style={styles.textNormalThemeText}>{translate('debug.none')}</Text>}
                </View>

here

<View style={[styles.mb5, styles.ph5, styles.gap5]}>
                    {booleanFields.map(([key, value]) => (
                        <InputWrapper
                         
                            InputComponent={CheckboxWithLabel}
                            label={key}
                            inputID={key}
                            shouldSaveDraft
                            accessibilityLabel={key}
                            defaultValue={value}
                        />
                    ))}
                    {booleanFields.length === 0 && <Text style={styles.textNormalThemeText}>{translate('debug.none')}</Text>}
                </View>

and in src/pages/Debug/Report/DebugReportPage

   {metadata?.map(({title, subtitle, message, action}) => (
                        <View style={[StyleUtils.getBackgroundColorStyle(theme.cardBG), styles.p5, styles.br4, styles.flexColumn, styles.gap2]}>
                            <View style={[styles.flexRow, styles.justifyContentBetween]}>
                                <Text style={styles.h4}>{title}</Text>
                                <Text>{subtitle}</Text>
                            </View>
                            {!!message && <Text style={styles.textSupporting}>{message}</Text>}
                            {!!action && (
                                <Button
                                    text={action.name}
                                    onPress={action.callback}
                                />
                            )}
                        </View>
                    ))}

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

  1. We should wrap the ConstantSelector and DateTimeSelector components with React.forwardRef here and here to make them compatible with InputWrapper, which expects the passed InputComponent to support refs. This will eliminate the warning:

Warning: Function components cannot be given refs. Did you mean to use React.forwardRef()?

However, wrapping these components in forwardRef introduces a second warning if the ref parameter is omitted in the component function signature:

Warning: forwardRef render functions accept exactly two parameters: props and ref. Did you forget to use the ref parameter?

To resolve both warnings, we will:

  • Wrap the components in React.forwardRef
  • Add an unused ref parameter to their function signature (even though it's not needed at this time)

This solution preserves the current functionality while making the components compatible with the ref-passing behavior of InputWrapper, avoiding any runtime warnings.

export default forwardRef(ConstantSelector);

and

export default forwardRef(DateTimeSelector);
  1. We should pass the key as a prop to the InputWrapper in specified places. here, here, and here
  <InputWrapper
          key={key}

and pass the title as the key in src/pages/Debug/Report/DebugReportPage

   <View style={[styles.mb5, styles.ph5, styles.gap5]}>
                    {metadata?.map(({title, subtitle, message, action}) => (
                        <View
                            key={title}
                            style={[StyleUtils.getBackgroundColorStyle(theme.cardBG), styles.p5, styles.br4, styles.flexColumn, styles.gap2]}
                        >

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

N / A

What alternative solutions did you explore? (Optional)

@sonialiap sonialiap added the External Added to denote the issue can be worked on by a contributor label May 8, 2025
Copy link

melvin-bot bot commented May 8, 2025

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

@melvin-bot melvin-bot bot changed the title Console Errors on Report Debug Page [$250] Console Errors on Report Debug Page May 8, 2025
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label May 8, 2025
Copy link

melvin-bot bot commented May 8, 2025

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

@parasharrajat
Copy link
Member

@nabi-ebrahimi's proposal looks good to me.

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented May 8, 2025

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

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label May 8, 2025
Copy link

melvin-bot bot commented May 8, 2025

📣 @nabi-ebrahimi 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 📖

@nabi-ebrahimi
Copy link
Contributor

I'll submit the PR tomorrow.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels May 9, 2025
@nabi-ebrahimi
Copy link
Contributor

PR is ready.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels May 15, 2025
@melvin-bot melvin-bot bot changed the title [$250] Console Errors on Report Debug Page [Due for payment 2025-05-22] [$250] Console Errors on Report Debug Page May 15, 2025
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label May 15, 2025
Copy link

melvin-bot bot commented May 15, 2025

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented May 15, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.45-21 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 2025-05-22. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented May 15, 2025

@parasharrajat @sonialiap @parasharrajat The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@nabi-ebrahimi
Copy link
Contributor

nabi-ebrahimi commented May 15, 2025

@parasharrajat Hi, it's my first job on Expensify. What's the next step for me?

@parasharrajat
Copy link
Member

PR is merged. You will be paid on 22 May if there are no regression.

@nabi-ebrahimi
Copy link
Contributor

Do I need to add BugZero Checklist as well?

@parasharrajat
Copy link
Member

Nope, I will do that.

@parasharrajat
Copy link
Member

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other:

Where bug was reported:

  • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
  • 2b. Reported on staging (eg. found during regression or PR testing)
  • 2d. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other:
  • [Contributor] 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: Improvements

  • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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: Not needed

  • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

  • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

    Link to issue:

Regression Test Proposal

Not needed. Its a debug feature.

Do we agree 👍 or 👎

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
Status: No status
Development

No branches or pull requests

5 participants