[Bug]: webagg backend uses non-existent unload event

Aperta
#32,393 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

  • #32402 di @kokhlo — chiusa senza merge

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
javascript
Ambito
frontend

Direzione di ricerca

Start at lib/matplotlib/backends/web_backend/js/mpl.js lines 83-85 and inspect how the WebAgg image and websocket lifecycle are connected. Check the browser behavior described in the issue, then determine whether websocket cleanup needs another location. Done means the invalid image unload handler is addressed and the WebAgg websocket behavior remains correct.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

GUI: webagg Maintenance
Bug summary

The webagg backend uses the onunload attribute of the image to close the websocket:
https://github.com/matplotlib/matplotlib/blob/c1afaeca985ba7cfce0bfcef40a315f641855456/lib/matplotlib/backends/web_backend/js/mpl.js#L83-L85

I cannot find any such event for Images, for its parent HTMLElement interface, or for its parent Element class, or even the Node ABC.

The docs for the unload event say that it is only on the global Window interface, with onunload on the body, frameset, and svg elements. It is also not recommended for use.

Code for reproduction

In the browser console:

var img = new Image();
img.on<TAB>
Actual outcome

There is no onunload in the autocomplete in the browser console.

Expected outcome

We should remove the onunload entirely, but I am uncertain as to whether we should be closing the websocket explicitly somewhere else.

Matplotlib Version

main

Matplotlib Backend

WebAgg

Installation

git checkout

Lingua principale
Python
Stelle
23.5k
Fork
8.6k
Merge medio
1g 19h
PR unite (30g)
64

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di matplotlib/matplotlib

Tutte le issue di matplotlib/matplotlib

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.