You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Toast Component: Need indefinite duration option for async operations
New feature to an existing component
The Toast component from @nimbus-ds/toast currently requires a fixed duration value in milliseconds. This forces developers to guess or set arbitrarily long durations for operations with unknown completion times (like file uploads or API calls).
Example of current implementation: addToast({ type: "info", text: "Uploading files...", duration: 3000, // Forces us to set a fixed duration });
Expected Behavior
The Toast component should:
Support an indefinite duration option (e.g., duration: null or duration: "infinite")
Provide a method to manually dismiss toasts
Allow updating toast content during long-running operations
Desired API could look like: const toastId = addToast({ type: "info", text: "Uploading files...", duration: null }); removeToast(toastId);
Use Cases
File uploads with variable duration
API calls with unknown response times
Long-running background operations
Multi-step processes where progress needs to be shown
Why This Matters
Without this feature, developers are forced to:
Set arbitrarily long durations that might be too short or unnecessarily long
Create custom notification systems for long operations
Risk poor UX where loading indicators disappear before operations complete
Suggested Implementation
Add support for:
null or infinite duration value
removeToast(id) method for manual control
Optional update(id, newConfig) method for updating existing toasts
This would align with common patterns seen in other popular toast libraries like react-toastify and react-hot-toast.
Additional Context
This issue was discovered while implementing a multi-file upload feature where the upload duration varies based on file size and quantity. The current implementation forces us to either:
Set a very long duration (potentially showing stale toasts)
Set a short duration (risking the toast disappearing before completion)
Create a custom notification system (defeating the purpose of using a shared component library)
The text was updated successfully, but these errors were encountered:
Toast Component: Need indefinite duration option for async operations
The Toast component from @nimbus-ds/toast currently requires a fixed duration value in milliseconds. This forces developers to guess or set arbitrarily long durations for operations with unknown completion times (like file uploads or API calls).
Example of current implementation:
addToast({ type: "info", text: "Uploading files...", duration: 3000, // Forces us to set a fixed duration });
Expected Behavior
The Toast component should:
Support an indefinite duration option (e.g., duration: null or duration: "infinite")
Provide a method to manually dismiss toasts
Allow updating toast content during long-running operations
Desired API could look like:
const toastId = addToast({ type: "info", text: "Uploading files...", duration: null }); removeToast(toastId);
Use Cases
File uploads with variable duration
API calls with unknown response times
Long-running background operations
Multi-step processes where progress needs to be shown
Why This Matters
Without this feature, developers are forced to:
Set arbitrarily long durations that might be too short or unnecessarily long
Create custom notification systems for long operations
Risk poor UX where loading indicators disappear before operations complete
Suggested Implementation
Add support for:
null or infinite duration value
removeToast(id) method for manual control
Optional update(id, newConfig) method for updating existing toasts
This would align with common patterns seen in other popular toast libraries like react-toastify and react-hot-toast.
Additional Context
This issue was discovered while implementing a multi-file upload feature where the upload duration varies based on file size and quantity. The current implementation forces us to either:
Set a very long duration (potentially showing stale toasts)
Set a short duration (risking the toast disappearing before completion)
Create a custom notification system (defeating the purpose of using a shared component library)
The text was updated successfully, but these errors were encountered: