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
This looks like something I forgot to port from v1 -- there was an autohideTimeout that could be configured a bit easier.
This also might be a good time to redo the alert package since I didn't understand hooks or typescript when I wrote that package and it's a bit of a mess...
A current "workaround" for this would be something like (untested):
import{useQueue,useAddMessage,useMessageQueueActions}from"@react-md/alert";// assuming `messageId` is: `{{MESSAGE_ID}}-{{TIMEOUT}}// example: `MY_MESSAGE-50000`constgetTImeout=(message: ToastMessage|undefined): number|undefined=>{consttimeout=parseInt((message?.messageId??'').replace(/^.+-/,''),10);returnNumber.isNaN(timeout) ? undefined : timeout;};constqueue=useQueue();constaddMessage=useAddMessage();const{ hideMessage }=useMessageQueueActions();const[message]=queue;useEffect(()=>{constduration=getTimeout(message);if(!duration){return;}consttimeout=window.setTImeout(hideMessage,duration);return()=>{window.clearTImeout(timeout);};},[message]);return(<ButtononClick={()=>{addMessage({messageId: 'MyMessage-50000',disableAutoHide: true.});}}>
Text
</Button>);
The text was updated successfully, but these errors were encountered:
This looks like something I forgot to port from v1 -- there was an
autohideTimeout
that could be configured a bit easier.This also might be a good time to redo the alert package since I didn't understand hooks or typescript when I wrote that package and it's a bit of a mess...
A current "workaround" for this would be something like (untested):
The text was updated successfully, but these errors were encountered: