Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Fix graph issues #178

Merged
merged 6 commits into from
Mar 28, 2018
Merged

Fix graph issues #178

merged 6 commits into from
Mar 28, 2018

Conversation

chriddyp
Copy link
Member

`state.hasPlotted` isn’t used in any rendering, so we don’t need to
trigger the react lifecycle through `setState`
instead of clearing the listeners before plotting. clearing the
listeners was causing some problem for some reason, not sure why.
@chriddyp
Copy link
Member Author

@mjkramer - If you're still around, would you mind elaborating on this comment? #171 (comment) I'm essentially patching this with that suggestion but I'm forgetting what you meant by

OK, previous "solution" is no bueno because it prevents the handlers from seeing the updated props. Now I see why bindEvents was being called repeatedly.

@chriddyp
Copy link
Member Author

@plotly/dash or @plotly/frontend - could someone review?

@chriddyp
Copy link
Member Author

chriddyp commented Mar 27, 2018

@charleyferrari - could you check if this fixes the resizing issue that you saw in your latest dashboard project? try out the prerelease with

pip install dash-core-components==0.21.1rc4

@mjkramer
Copy link

Hi Chris. When bindEvents is only called once, don't those callbacks end up always seeing the props as they were at the time that bindEvents was called? Or is it irrelevant (i.e. do clear_on_hover, setProps, and fireEvent never change)? Why not, in addition to the if (!this._hasPlotted) fix, get rid of the props argument to bindEvents, and just let the callbacks access this.props directly? I do this in my components, and while I can't claim to fully understand what's going on under the hood, I haven't seen any issues.

`setProps` and `fireEvent` are the connected functions that
`dash-renderer` passes into the components to propagate changes from
the component to the greater dash application.

these props should either be supplied all of the time or none of the
time, as the component dependency tree is defined up-front in the app.
@chriddyp
Copy link
Member Author

thanks @mjkramer ! agreed, this.props should suffice here.

@chriddyp
Copy link
Member Author

Fixes the issues in the docs https://github.com/plotly/dash-docs/issues/81
image

@nicolaskruchten
Copy link
Contributor

The resize thing looks good to me!

@chriddyp
Copy link
Member Author

Ping @charleyferrari re #178 (comment)

@plotly plotly deleted a comment from charleyferrari Mar 28, 2018
@chriddyp chriddyp merged commit 81dfc3b into master Mar 28, 2018
@chriddyp chriddyp deleted the fix-graphs branch March 28, 2018 18:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants