-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 2024-10-30] [$250] [DEV] - Console Warning: Function components cannot be given refs #50676
Comments
Triggered auto assignment to @garrettmknight ( |
This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989 |
ProposalPlease re-state the problem that we are trying to solve in this issue.We are facing a warning message in our iOS app that says, "Function components cannot be given refs." This warning appears when users try to interact with chat messages What is the root cause of that problem?The root cause of this problem is that some functional components in our app are being assigned refs, but they are not set up to handle them. In React, functional components do not accept refs by default, which leads to this warning. What changes do you think we should make in order to solve the problem?To solve this problem, we should update the functional component by wrapping it with React.forwardRef(). This will allow these components to accept and properly use refs without generating warnings. What alternative solutions did you explore? (Optional) |
ProposalPlease re-state the problem that we are trying to solve in this issue.Encountering a console error: "Function components cannot be given refs" when long-pressing the message. What is the root cause of that problem?This specific issue is originating from the usage of What changes do you think we should make in order to solve the problem?I suggest a similar approach as with this issue: we should replace For this issue, we can focus on the What alternative solutions did you explore? (Optional)If right now we dont want to replace the usage of useOnyx instead of withOnyx then we can do use the forwardRef for BaseReportActionContextMenu like this:
const BaseReportActionContextMenu = React.forwardRef(function BaseReportActionContextMenu({ |
Job added to Upwork: https://www.upwork.com/jobs/~021845992163268596085 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @hoangzinh ( |
Thanks for all your proposals. Btw, @jayeshmangwani proposal looks good to me Link to proposal #50676 (comment) 🎀👀🎀 C+ reviewed |
Triggered auto assignment to @rlinoz, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
I think GH Actions will fail if we touch those files and don't replace the |
📣 @hoangzinh 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app! |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.52-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 2024-10-30. 🎊 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:
|
@rojiphil did you work on this one at all or just report it? |
Payment Summary:
|
I don't think a checklist is needed here since these are console warning and should have been caught when we initially passed the ref to the functional component during creation or migration of the page. |
Agreed @jayeshmangwani. |
@garrettmknight I just reported it. No payment is due for me here. Thanks. |
Thanks, I'll undo the payment and we can close. |
@hoangzinh I accidentally requested a refund on this one in Upwork. Please decline. |
Okay, no worry @garrettmknight |
I confirm that this payment summary is accurate. |
$250 approved for @jayeshmangwani |
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: Dev
Reproducible in staging?: dev
Reproducible in production?: dev
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: @rojiphil
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1728537899975699
Action Performed:
Expected Result:
The warning
Function components cannot be given refs.
should not come-up.Actual Result:
The following warning is displayed:
Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
console-warning.mp4
Add any screenshot/video evidence
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @garrettmknightThe text was updated successfully, but these errors were encountered: