Unexpected behavior with combination: update & limit
When you try following code when toast container have set limit=1, expected behavior should be same in both runs, but it is not, in the second run it shows fist message and not last (updated):
function onClick() {
const id = toast.success('a')
toast.update(id, {render: 'b'})
toast.update(id, {render: 'c'})
}
onClick();
onClick();
During first "onClick()" run is eventually (instantly) showed 'c' After close (manually or after time out), second "onClick()" show 'a' (even twice - but this can be related with another issue)
@KubaChoice can you reproduce the issue on codesanbox or share a repository thank you
Hi There it is: https://codesandbox.io/s/toastify-update-que-issue-eo21yj?file=/src/index.js
- it seems that update() method works only on active notifications
This is very nice tool, however working with queue is limited, it is pity Working with queue (in my case) missing at least following:
- update queued notifications (this issue)
- check if notification (id) is queued
- remove specific notification (id) from queue
- add/relocate notification (id) to queue to specified position
In this case I'm "forced" to write own queue Still nice tool
Hey @KubaChoice, you're right. update only works with active notification. I think I could address the following point in a future version as they make sense
- update queued notifications (this issue)
- check if notification (id) is queued
- remove specific notification (id) from queue
Regarding add/relocate notification (id) to queue to specified position, not too complicated to implement but It might require a bit more time to get the API right.