-
Notifications
You must be signed in to change notification settings - Fork 834
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
Stateless function components cannot be given refs. Attempts to access this ref will fail #861
Comments
I'm having exactly the same issue on a budget/financial planning application I'm working on. |
Same here. Version of "react-vis": "^1.10.1" import React from 'react'
import { XYPlot, FlexibleWidthXYPlot, makeWidthFlexible, XAxis, YAxis, HorizontalGridLines, LineMarkSeries, CustomSVGSeries } from 'react-vis'
export default class Chart extends React.Component {
className = 'Chart'
blueColor = "#0078ff"
lineColor = this.blueColor
markStyle = { stroke: this.blueColor, fill: this.blueColor }
render() {
const { width, height } = this.props;
let plot = (
<FlexibleWidthXYPlot
height={height}>
<HorizontalGridLines />
<LineMarkSeries
color={this.blueColor}
data={[
{ x: 1, y: 100 },
{ x: 2, y: 400 },
{ x: 3, y: 300 },
{ x: 4, y: 500 },
{ x: 5, y: 600 },
{ x: 6, y: 400 },
{ x: 7, y: 500 },
]} />
<CustomSVGSeries
// className="custom-marking"
customComponent="square"
data={[
{ x: 1, y: 100, size: 6, style: { stroke: this.blueColor, fill: this.blueColor } },
{ x: 2, y: 400, size: 6, style: { stroke: this.blueColor, fill: this.blueColor } },
{ x: 3, y: 300, size: 6, style: { stroke: this.blueColor, fill: this.blueColor } },
{ x: 4, y: 500, size: 6, style: { stroke: this.blueColor, fill: this.blueColor } },
{ x: 5, y: 600, size: 6, style: { stroke: this.blueColor, fill: this.blueColor } },
{ x: 6, y: 400, size: 6, style: { stroke: this.blueColor, fill: this.blueColor } },
{ x: 7, y: 500, size: 6, style: { stroke: this.blueColor, fill: this.blueColor } },
]} />
{/* <XAxis /> */}
<YAxis />
</FlexibleWidthXYPlot>
);
return plot;
// return makeWidthFlexible(plot);
}
} |
Same for me. Reverting to 1.10.0 removes the errors. 00ffe61 appears to be the cause. |
@benshope mind taking a look at this? |
@mcnuttandrew on it 🐛 🔨 |
Should be fixed in |
I've just tried in 1.10.2 and still receiving the same error with the example code. |
Same for me @ericzon. |
Interesting, okay, re-opening |
Should 🙏 be fixed in 1.10.3 |
Looks like that fixed it. Thanks @benshope and @mcnuttandrew for the work on this. |
@benshope @mcnuttandrew I don't think this solves correctly the issue and I've found few problem on that:
...(dataProps && child.type.prototype child.type.prototype.render) ? { refs } : {} In the current implementation you will never add any ref because you are checking for
|
* Updated react-vis to 1.10.2 The features we introduced in XYPlot are now merged into react-vis after uber/react-vis#857. The XYPlotExtended class is removed. The div aroung the XYPlot is also removed since it's not required. All snapshots are updated after this removal. * Updated CHANGELOG * Reverting 492d28a to keep the wrapping div around the chart * Fixed the react-vis version to the stable one. Check this issue comments to see the status: uber/react-vis#861
@benshope after upgrading to 1.10.3, it looks like the zoomable plot doesn't work anymore. In fact inspection shows that all mouse events are not triggering. I tried to run the examples directly in the repo from source they work well. But when used with the compiled 1.10.3 it doesn't work anymore. |
@episodeyang i think there's one more patch coming down the pipe see #874 |
@mcnuttandrew Thanks Andrew! down grading to 1.10.1 fixed the handler responses. Looking forward to #874. btw congrats on UChicago :P didn't know you started last year. |
Should be fixed in 1.10.4 by #874 |
Following errors thrown while trying to render a Line Chart from the demo here.
Steps to reproduce
Do a
yarn start
and see the console.package.json
My guess is that the
XYPlot
component in function_getClonedChildComponents
is addingref
to the props of the child components, while the children can easily be SFCs (In the example above the componentsHorizontalGridLines
,VerticalGridLines
,XAxis
,YAxis
are all SFC insideXYPlot
component, hence the 4 exceptions) and in that case the exception is thrown.The text was updated successfully, but these errors were encountered: