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
childrenOf and childrenOfType fail with react-hot-loader #2641
Comments
Hi @liviudobrea! 👋 I definitely wouldn't mind the first one given that it's the proper solution, in this case. My only concern would be if using that solution could potentially harm consumers who aren't using RHL? If that's the case, wouldn't mind a general |
@joshblack Will run some intentional mis-usage test cases, with and without |
Implementation in #859 |
Another take at it in #1253 |
- Remove react-hot-loader dep; - Add react-proxy to help with testing; - Add internal helper to check for component type equality in case of proxied components;
- Optimize for prettier;
@joshblack I noticed that both of the attempted solutions to this issue ended up not getting merged in. Seems like #1253 in particular was super close to getting merged! Are there plans for someone from the core |
@oliverodaa most likely we'll loosen our prop type definitions versus trying to fix it 😞 It's a very hard bug to fix which is why most PRs tend to die down. Definitely feel free to contribute a fix based on 1253, was looking pretty promising 😄 |
We've marked this issue as stale because there hasn't been any activity for a couple of weeks. If there's no further activity on this issue in the next three days then we'll close it. Thanks for your contributions. |
Hi there! 👋 If you're wondering why this issue was moved, we're currently updating our repo structure so that every package is found in the same project. This should not have any impact for you, but we wanted to give you a heads up in case you were wondering what is going on. If you have any questions, feel free to reach out to us on Slack or contact us at: carbon@us.ibm.com. Thanks! |
Detailed description
react-hot-loader (v4.x.x)
(will further refer to this as RHL) wraps every React component in a ProxyComponent, to internally handle the change / reload mechanism. That is all good, however, by usingRHL
withcarbon-components-react
, this statement https://github.com/carbon-design-system/carbon-components-react/blob/706584394a321c30c56367f1fee930a82fb26236/src/prop-types/childrenOf.js#L24-L28 and this statement https://github.com/carbon-design-system/carbon-components-react/blob/706584394a321c30c56367f1fee930a82fb26236/src/prop-types/childrenOfType.js#L20-L24 will always throw something similar to this:This is not necessary an issue with the current code, but it becomes a bug when using this with the RHL 3rd party library (which I'm guessing many are).
This is an acknowledged issue with RHL. More details here gaearon/react-hot-loader#304.
Some Solutions
I'm not sure if this is a good enough reason to add RHL as a project dependency, but it provides the cleanest solution.
This one's a tad uglier, but it also works. However, since RHL API could change at any given time, this is more likely to fail at some point.
More than happy to PR if you're ok with either of those.
The text was updated successfully, but these errors were encountered: