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

Aberta
#32,393 4 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

  • #32402 de @kokhlo — fechado sem integrar

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
68/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
javascript
Domínio
frontend

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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

Linguagem predominante
Python
Estrelas
23.5k
Forks
8.6k
Merge médio
1d 19h
PRs com merge (30d)
64

Preparar o ambiente

Abrir no Codespaces

Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de matplotlib/matplotlib

Todas as issues de matplotlib/matplotlib

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.