plotly / plotly/plotly.js

Purging and removing element while hovering causes "undefined is not an object"

Aperta
#6,047 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug P3
Lingua principale
JavaScript
Stelle
18.3k
Fork
2k
Merge medio
2g 12h
PR unite (30g)
28

Descrizione

So, I'm unsure if this issue is with the react library or this one. But the responsible code resides in this repository so I'll try my luck here.

If you unmount a plot rendered in react while hovering your mouse over it, maindrag.onmouseout gets triggered before all event handlers are completely unregistered.

This causes the error undefined is not an object (evaluating 'gd._fullLayout._hoversubplot = null') at plotly.js:148662==graph_interact.js:79. I looked into it with a breakpoint and the issue seems to be that _fullLayout doesn't exist anymore on gd.

A simple fix (assuming this is an issue with plotly.js and not react-plotly.js) could be to just add || !dg._fullLayout to graph_interact.js:74. If it isn't an issue with plotly itself, it may still be a good idea to wrap the event handlers with try/catch and log a warning about not unmounting correctly instead of a flat out error.

Guida per i contributori

Apri la guida per i contributori

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.

Direzione di ricerca

Inizia in src/plots/cartesian/graph_interact.js, intorno alle righe 74-79, e riproduci il problema eseguendo l’unmount di un grafico renderizzato da React mentre è in hover. Verifica che la pulizia dell’hover non generi più un errore quando gd._fullLayout è assente, preservando il normale comportamento di mouseout.

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

Valutazione

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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.