You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Seeing an issue where wrapping a component in forwardRef results in the descriptions resolving to null.
Works:
import PropTypes from 'prop-types';
import React from 'react';
const Label = ({ children, ...other }) => {
return <div {...other}>{children}</div>;
};
Label.propTypes = {
/** Content of the label */
children: PropTypes.node,
/** Blue style label */
blue: PropTypes.bool,
/** Green style label */
green: PropTypes.bool,
/** Yellow style label */
yellow: PropTypes.bool,
/** Red style label */
red: PropTypes.bool
};
Label.defaultProps = {};
export default Label;
Broken:
import PropTypes from 'prop-types';
import React, {forwardRef} from 'react';
const Label = forwardRef(({ children, ...other }, ref) => {
return <div {...other} ref={ref}>{children}</div>;
});
Label.propTypes = {
/** Content of the label */
children: PropTypes.node,
/** Blue style label */
blue: PropTypes.bool,
/** Green style label */
green: PropTypes.bool,
/** Yellow style label */
yellow: PropTypes.bool,
/** Red style label */
red: PropTypes.bool
};
Label.defaultProps = {};
export default Label;
It's interesting that the rest of the prop definition exists and only the description is dropped. Is this a known issue? It seems slightly different from other issues related to HOC in that even if the component name is resolved correctly, the prop definition is not complete.
The text was updated successfully, but these errors were encountered:
@danez Confirmed to fix the issue I was seeing. This can be closed.
To followup though, it looks like the fix required a special handler for forwardRef as a known hoc. Does that mean all hoc's would need to be handled specially? Are custom hoc's not supported?
@codylawsonforwardRef is not a HOC but a "normal" component. The issue was that forwardRef was not considered a component and therefore not eligible for HOC wrapping.
@danez It doesn't seem like #311 is included in 3.0.0-rc.2 which was merged with b048d58 into master. Any chance you can cut a release?
Seeing an issue where wrapping a component in
forwardRef
results in the descriptions resolving tonull
.Works:
Broken:
It's interesting that the rest of the prop definition exists and only the description is dropped. Is this a known issue? It seems slightly different from other issues related to HOC in that even if the component name is resolved correctly, the prop definition is not complete.
The text was updated successfully, but these errors were encountered: