acl-services / acl-services/paprika

Using same Toast multiple times with canAutoClose

Abierto
#1,016 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Bug 🐞 Editor's Choice
Lenguaje dominante
JavaScript
Estrellas
54
Forks
10
Merge medio
1 d 12 h
PR fusionados (30 d)
6

Descripción

The `Toast` has a `canAutoClose` prop which works fine the first time, but fails on subsequent uses of the `Toast`. For example:

- have a button and when you press the button, the `Toast` appears
- give the `Toast` the `canAutoClose` prop, so it closes automatically after a few seconds
- after the `Toast` closes, if you press the button again, the `Toast` should appear again, but it doesn't

Nahum's clever work-around to make it work:

```
const [key, nextKey] = React.useState(0)
handleSomethingEventInYourApp() {
nextKey(prev => prev + 1)
}

```

This should work without a clever work-around. From Nahum: "I think the Toast is missing the part of reseting its internal state after closing so it can be open again"

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Start in the Toast component implementation where `canAutoClose` is handled and inspect the logic for close/open state transitions. Reproduce the flow from the report (show toast, auto-close, show again) in a local example to confirm the bug path. Identify where the component state is reset after close and compare with the workaround behavior; if tests exist for Toast behavior, add a regression case for reopen-after-autoclose and run those tests.

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

Evaluación

Stack tecnológico
javascript, react
Área
frontend
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
52/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.