diff --git a/Composer/packages/client/src/pages/publish/index.tsx b/Composer/packages/client/src/pages/publish/index.tsx index 2ac4b26ba5..ac229fd272 100644 --- a/Composer/packages/client/src/pages/publish/index.tsx +++ b/Composer/packages/client/src/pages/publish/index.tsx @@ -141,6 +141,14 @@ const Publish: React.FC = (props) => { } }; + useEffect(() => { + // if url was wrong, redirect to all profiles page + const activeDialog = settings.publishTargets?.find(({ name }) => name === selectedTargetName); + if (!activeDialog && selectedTargetName !== 'all') { + navigateTo(`/bot/${projectId}/publish/all`); + } + }, [selectedTargetName, projectId, settings.publishTargets]); + useEffect(() => { if (projectId) { actions.getPublishTargetTypes(); diff --git a/Composer/packages/client/src/store/action/publisher.ts b/Composer/packages/client/src/store/action/publisher.ts index fa67acd297..685d36c66f 100644 --- a/Composer/packages/client/src/store/action/publisher.ts +++ b/Composer/packages/client/src/store/action/publisher.ts @@ -4,10 +4,10 @@ import formatMessage from 'format-message'; import { ActionCreator } from '../types'; +import filePersistence from '../persistence/FilePersistence'; import { ActionTypes } from './../../constants/index'; import httpClient from './../../utils/httpUtil'; - export const getPublishTargetTypes: ActionCreator = async ({ dispatch }) => { try { const response = await httpClient.get(`/publish/types`); @@ -121,6 +121,7 @@ export const getPublishStatus: ActionCreator = async ({ dispatch }, projectId, t export const getPublishHistory: ActionCreator = async ({ dispatch }, projectId, target) => { try { + await filePersistence.flush(); const response = await httpClient.get(`/publish/${projectId}/history/${target.name}`); dispatch({ type: ActionTypes.GET_PUBLISH_HISTORY, diff --git a/Composer/packages/client/src/store/persistence/FilePersistence.ts b/Composer/packages/client/src/store/persistence/FilePersistence.ts index a6bb46a819..cbca303bf6 100644 --- a/Composer/packages/client/src/store/persistence/FilePersistence.ts +++ b/Composer/packages/client/src/store/persistence/FilePersistence.ts @@ -93,7 +93,7 @@ class FilePersistence { if (this._isFlushing) { return new Promise((resolve) => { const timer = setInterval(() => { - if (!this.isEmpty()) { + if (this.isEmpty()) { clearInterval(timer); resolve(true); }