fix(editor): Fix workflow back button navigation (#4546)

* 🐛 Fix back button navigation from recetly saved workflow

* 🐛 Fix coming-soon routes
This commit is contained in:
OlegIvaniv
2022-11-09 09:31:23 +01:00
committed by GitHub
parent 740df0c1e5
commit 825637f02a
11 changed files with 368 additions and 355 deletions

View File

@@ -220,7 +220,7 @@ import { useUIStore } from '@/stores/ui';
import { useSettingsStore } from '@/stores/settings';
import { useUsersStore } from '@/stores/users';
import { getNodeViewTab } from '@/components/helpers';
import { Route } from 'vue-router';
import { Route, RawLocation } from 'vue-router';
import { useWorkflowsStore } from '@/stores/workflows';
import { useRootStore } from '@/stores/n8nRootStore';
import { useNDVStore } from '@/stores/ndv';
@@ -347,11 +347,25 @@ export default mixins(
if (confirmModal === MODAL_CONFIRMED) {
const saved = await this.saveCurrentWorkflow({}, false);
if (saved) this.settingsStore.fetchPromptsData();
if (saved) await this.settingsStore.fetchPromptsData();
this.uiStore.stateIsDirty = false;
next();
if(from.name === VIEWS.NEW_WORKFLOW) {
// Replace the current route with the new workflow route
// before navigating to the new route when saving new workflow.
this.$router.replace({ name: VIEWS.WORKFLOW, params: { name: this.currentWorkflow } }, () => {
// We can't use next() here since vue-router
// would prevent the navigation with an error
this.$router.push(to as RawLocation);
});
} else {
next();
}
} else if (confirmModal === MODAL_CANCEL) {
await this.resetWorkspace();
this.uiStore.stateIsDirty = false;
next();
} else if (confirmModal === MODAL_CLOSE) {
next(false);