Skip to content

Commit

Permalink
Fix #3716: The show() method causes the browser to crash. (#3717)
Browse files Browse the repository at this point in the history
* Fix #3716: The show() method causes the browser to crash.

* Fix #3716: Toast/Message the show() method causes the browser to crash.
  • Loading branch information
habubey authored Nov 29, 2022
1 parent 80db560 commit 312199c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
19 changes: 10 additions & 9 deletions components/lib/messages/Messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,16 @@ export const Messages = React.memo(
return (
<div id={props.id} ref={elementRef} className={props.className} style={props.style} {...otherProps}>
<TransitionGroup>
{messagesState.map((message) => {
const messageRef = React.createRef();

return (
<CSSTransition nodeRef={messageRef} key={message.id} classNames="p-message" unmountOnExit timeout={{ enter: 300, exit: 300 }} options={props.transitionOptions}>
<UIMessage ref={messageRef} message={message} onClick={props.onClick} onClose={onClose} />
</CSSTransition>
);
})}
{messagesState &&
messagesState.map((message) => {
const messageRef = React.createRef();

return (
<CSSTransition nodeRef={messageRef} key={message.id} classNames="p-message" unmountOnExit timeout={{ enter: 300, exit: 300 }} options={props.transitionOptions}>
<UIMessage ref={messageRef} message={message} onClick={props.onClick} onClose={onClose} />
</CSSTransition>
);
})}
</TransitionGroup>
</div>
);
Expand Down
19 changes: 10 additions & 9 deletions components/lib/toast/Toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,16 @@ export const Toast = React.memo(
return (
<div ref={containerRef} id={props.id} className={className} style={props.style} {...otherProps}>
<TransitionGroup>
{messagesState.map((messageInfo) => {
const messageRef = React.createRef();

return (
<CSSTransition nodeRef={messageRef} key={messageInfo._pId} classNames="p-toast-message" unmountOnExit timeout={{ enter: 300, exit: 300 }} onEntered={onEntered} onExited={onExited} options={props.transitionOptions}>
<ToastMessage ref={messageRef} messageInfo={messageInfo} onClick={props.onClick} onClose={onClose} onMouseEnter={props.onMouseEnter} onMouseLeave={props.onMouseLeave} />
</CSSTransition>
);
})}
{messagesState &&
messagesState.map((messageInfo) => {
const messageRef = React.createRef();

return (
<CSSTransition nodeRef={messageRef} key={messageInfo._pId} classNames="p-toast-message" unmountOnExit timeout={{ enter: 300, exit: 300 }} onEntered={onEntered} onExited={onExited} options={props.transitionOptions}>
<ToastMessage ref={messageRef} messageInfo={messageInfo} onClick={props.onClick} onClose={onClose} onMouseEnter={props.onMouseEnter} onMouseLeave={props.onMouseLeave} />
</CSSTransition>
);
})}
</TransitionGroup>
</div>
);
Expand Down

0 comments on commit 312199c

Please sign in to comment.