question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Planning] Onyx break forwardRef flow.

See original GitHub issue

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Due to we stop rendering of the WrappedComponent until Onyx is ready to pass the props. It breaks the ForwardRef flow. Usually, Ref should be available in componentDidMount of the Parent component. But this is not the case in our App. If we use WithOnyx and ref is not available in the parent component’s componentDidMount.

Although this is against the best practice of React, I think we can’t solve this problem but I want to discuss the best approach to mitigate this.

Code Example:

Check the ReportActionMessageEdit.js component. TextInput Ref is not available in componentDidMount. Try removing withOnyx subscription in the TextInputFocusable.js and recheck.

Platform:

Where is this issue occurring?

Web ✔️ iOS ✔️ Android ✔️ Desktop App ✔️ Mobile Web ✔️

Version Number: Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation Expensify/Expensify Issue URL:

View all open jobs on Upwork

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
marcaaroncommented, Aug 21, 2021

Gonna close this as it’s not actionable right now. I feel like this could be a valuable problem to solve, but only if we are running into trouble where a withOnyx wrapped component needs to access a ref.

Even in that case, it might worth lifting the withOnyx wrapper higher in the chain if possible.

0reactions
parasharrajatcommented, Jul 14, 2021

I agree this is more of a planning issue thus I not proposing to solve it. I would raise this on Slack to see if I get anything out of it and decide to close accordingly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Supporting React.forwardRef and Beyond | Flow - Medium
In Flow v0.89.0, we're releasing React.AbstractComponent, a new type that we use to model forwardRef and other React components.
Read more >
React.memo and React.forwardRef after v0.100 #7815 - GitHub
Looks like it is impossible to use forwardRef and memo together in v0.100. React.memo uses ComponentType which hides ref type info from ...
Read more >
Forwarding Refs - React
When you start using forwardRef in a component library, you should treat it as a breaking change and release a new major version...
Read more >
React.forwardRef with generic Props type in flow
forwardRef and having no errors and no compromises on typing. Here are some things I've tried: // Complains T doesn't exist const Component...
Read more >
Supporting React.forwardRef and Beyond - JavaScript. Flow
We made some major changes to our React model to better model new React components. Let's talk about React.AbstractComponent!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found