Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix WebAgg initialization #19131

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

Merged
merged 2 commits into from
Dec 17, 2020
Merged

Fix WebAgg initialization #19131

merged 2 commits into from
Dec 17, 2020

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Dec 16, 2020

PR Summary

Sending the pixel ratio in initialization fails because the WebSocket is not open yet; this is already sent in the onopen handler, so just remove it from initialization.

Also, fix a similar bug in sending resizes too early. This one is non-fatal because it is in an async handler.

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • [n/a] New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • [n/a] New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • [n/a] API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

This is already done in the WebSocket's `onopen` function, and sending
it during the object's initialization crashes due to the WebSocket not
being ready.

Fixes matplotlib#19129.
Because this is behind the asynchronous `ResizeObserver`, it does _not_
cause a failure to initialize the JavaScript figure, but is similar in
error as the previous commit.
@QuLogic QuLogic added this to the v3.3.4 milestone Dec 16, 2020
@tacaswell
Copy link
Member

attn @ianhi

@tacaswell
Copy link
Member

I tested locally and this works again.

@tacaswell tacaswell added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Dec 17, 2020
Copy link
Contributor

@ianhi ianhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the issue for me as well.

@tacaswell
Copy link
Member

I'm going to merge on the strength of @ianhi review and this being a critical fix.

@tacaswell tacaswell merged commit 9372073 into matplotlib:master Dec 17, 2020
@QuLogic QuLogic deleted the fix-webagg branch December 17, 2020 22:09
@QuLogic
Copy link
Member Author

QuLogic commented Dec 17, 2020

Not sure why this didn't backport?

@meeseeksdev backport to v3.3.x

meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Dec 17, 2020
QuLogic pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Dec 22, 2020
QuLogic added a commit that referenced this pull request Dec 22, 2020
…131-on-v3.3.x

Backport PR #19131 on branch v3.3.x (Fix WebAgg initialization)
@ianhi ianhi mentioned this pull request Mar 22, 2021
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GUI: webagg Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants