diff --git a/mailpoet/assets/js/src/automation/editor/index.tsx b/mailpoet/assets/js/src/automation/editor/index.tsx index 5888df38d4..4e7be4bd87 100644 --- a/mailpoet/assets/js/src/automation/editor/index.tsx +++ b/mailpoet/assets/js/src/automation/editor/index.tsx @@ -115,22 +115,25 @@ function Editor(): JSX.Element { if (!isBooting) { return; } + if (automation.status === 'trash') { + window.location.href = addQueryArgs(MailPoet.urls.automationListing, { + notice: LISTING_NOTICES.automationHadBeenDeleted, + 'notice-args': [automation.name], + }); + } updatingActiveAutomationNotPossible(); setIsBooting(false); - }, [isBooting]); + }, [automation.name, automation.status, isBooting]); + + if (automation.status === 'trash') { + return null; + } + const className = classnames('interface-interface-skeleton', { 'is-sidebar-opened': isSidebarOpened, 'show-icon-labels': showIconLabels, }); - if (automation.status === 'trash') { - window.location.href = addQueryArgs(MailPoet.urls.automationListing, { - notice: LISTING_NOTICES.automationHadBeenDeleted, - 'notice-args': [automation.name], - }); - return null; - } - return (