acl-services / acl-services/paprika

Using same Toast multiple times with canAutoClose

Aperta
#1,016 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Bug 🐞 Editor's Choice
Lingua principale
JavaScript
Stelle
54
Fork
10
Merge medio
1g 12h
PR unite (30g)
6

Descrizione

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"

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

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.

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

Valutazione

Stack tecnologico
javascript, react
Ambito
frontend
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
52/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.