plotly / plotly/plotly.js

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

Abierto
#6,047 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

bug P3
Lenguaje dominante
JavaScript
Estrellas
18.3k
Forks
2k
Merge medio
2 d 12 h
PR fusionados (30 d)
28

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza en src/plots/cartesian/graph_interact.js, alrededor de las líneas 74-79, y reproduce el fallo desmontando un gráfico renderizado por React mientras está bajo el cursor. Verifica que la limpieza del hover ya no produzca un error cuando gd._fullLayout no esté presente, manteniendo al mismo tiempo el comportamiento normal de mouseout.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript
Área
data-visualization
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.