-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fix to enable switching modes using plotly react method on scattergl traces #3132
Conversation
Were you able to replicate the problem? I'm no opposed to this solution, but I'd like to understand why this happens. |
Hmm. I can't replicate. Do you have an idea why this happens? It smells like a race condition, but I'd like to confirm. |
We used to have similar checks before calling destroy in traces/splom/index.js |
Hmm I see. Referencing: plotly.js/src/traces/splom/index.js Lines 155 to 157 in 7ae6fd6
I put those lines in. I think they were intended to fix intermittent failures on CI. Note that removing that All in all, I'll like to get to the bottom of this issue. It doesn't have to be now though. A lot of users have commented on #2999, so maybe we should try to merge this fix in before 1.42.0 and take a deeper dive later. |
src/traces/scattergl/index.js
Outdated
if(scene.error2d) scene.error2d.destroy(); | ||
if(scene.line2d) scene.line2d.destroy(); | ||
if(scene.select2d) scene.select2d.destroy(); | ||
if((scene.fill2d) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking comment: We (me and @alexcjohnson ) would usually write these lines as
if(scene.fill2d && scene.fill2d.destroy) {
scene.fill2d.destroy();
}
src/traces/scattergl/index.js
Outdated
if(scene.glText) { | ||
scene.glText.forEach(function(text) { text.destroy(); }); | ||
scene.glText.forEach( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and this thing as
scene.glText.forEach(function(text) {
if(text.destroy) text.destroy();
});
Since I (and presumably other people) can't replicate the problem, it might be hard to write a jasmine test to lock this down. |
Interesting observation: Using the code identical to the one presented in the codepen on Chrome the |
here for scattergl -> plotly.js/src/plots/cartesian/index.js Lines 315 to 320 in 7ae6fd6
here for splom -> plotly.js/src/traces/splom/base_plot.js Lines 177 to 186 in 7ae6fd6
and similar logic will be added for scatterpolargl in #3098 |
This should fix the issue for switching |
Thanks for the update @archmoj ! It would be nice to investigate (and hopefully fix 😄 ) that FF too-many-webgl-context bug this afternoon. I can help out. |
We'll need to add a test before merging.
Creating another branch is fine 👌 |
I can help you add that test if you like. |
Great! Any help on tests would be much appreciated. |
This PR resolves the issue #2999 by providing additional checks before calling destroy functions of scattergl. Without these checks in scenarios namely switching back and forth between different modes e.g.
markers
tolines
and then back tomarkers
the program (depending on the device/browser) may complain and/or stop.@alexcjohnson