Only subscribe to redux when available

This commit is contained in:
Jamie Kyle 2023-06-14 15:29:34 -07:00 committed by GitHub
parent 4d354c8005
commit ab9d3f9494
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,6 +7,7 @@ import classNames from 'classnames';
import { createPortal } from 'react-dom';
import { useRestoreFocus } from '../hooks/useRestoreFocus';
import { clearTimeoutIfNecessary } from '../util/clearTimeoutIfNecessary';
import * as log from '../logging/log';
export type PropsType = {
autoDismissDisabled?: boolean;
@ -57,6 +58,10 @@ export const Toast = memo(function ToastInner({
updateAlign();
if (window.reduxStore == null) {
log.warn('Toast: No redux store');
return;
}
return window.reduxStore.subscribe(updateAlign);
}, []);