8000 webagg: Fix another too-early use of the WebSocket. · matplotlib/matplotlib@725e908 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 725e908

Browse files
committed
webagg: Fix another too-early use of the WebSocket.
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.
1 parent 30a900f commit 725e908

File tree

1 file changed

+1
-1
lines changed
  • lib/matplotlib/backends/web_backend/js

1 file changed

+1
-1
lines changed

lib/matplotlib/backends/web_backend/js/mpl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ mpl.figure.prototype._init_canvas = function () {
224224
// And update the size in Python. We ignore the initial 0/0 size
225225
// that occurs as the element is placed into the DOM, which should
226226
// otherwise not happen due to the minimum size styling.
227-
if (width != 0 && height != 0) {
227+
if (fig.ws.readyState == 1 && width != 0 && height != 0) {
228228
fig.request_resize(width, height);
229229
}
230230
}

0 commit comments

Comments
 (0)
0