adobe / adobe/react-spectrum

Enhance Toast Notifications: Add Update Functionality and Prevent Duplication Using Custom Keys or IDs

Open
#6,927 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
15.9k
Forks
1.6k
Avg merge
3d 9m
Merged PRs (30d)
59

Description

### Provide a general summary of the feature here

I’m using toast creation tools, but I’m facing an issue where I can’t pass a custom key or ID to prevent duplication or update existing toasts.

This functionality is crucial in scenarios where the notification represents task progress and needs to update based on the task status. Additionally, I need to be able to trigger the same notification from different places in the application. To avoid duplication, the notification should update if it’s already displayed.

### 🤔 Expected Behavior?

ToastQueue provides additional tools for updating and avoiding duplication

### 😯 Current Behavior

At the moment, no other tool has such functionality.

### 💁 Possible Solution

_No response_

### 🔦 Context

I resolved the duplication issue by including the ID in the options. I then check if this ID already exists in the toast array. If it’s not present, I add it to the queue.

I also implemented update functionality. While it works to some extent—updating the content—the changes only take effect when the queue is refreshed or the container is focused.

### 💻 Examples

_No response_

### 🧢 Your Company/Team

_No response_

### 🕷 Tracking Issue

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.