Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(editor): Prevent router.replace from computed property (no-changelog) #8489

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions packages/editor-ui/src/views/WorkflowsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
:initialize="initialize"
:disabled="readOnlyEnv"
@click:add="addWorkflow"
@update:filters="filters = $event"
@update:filters="onFiltersUpdated"
>
<template #add-button="{ disabled }">
<n8n-tooltip :disabled="!readOnlyEnv">
Expand Down Expand Up @@ -155,6 +155,14 @@ import { useTagsStore } from '@/stores/tags.store';

type IResourcesListLayoutInstance = InstanceType<typeof ResourcesListLayout>;

interface Filters {
search: string;
ownedBy: string;
sharedWith: string;
status: string | boolean;
tags: string[];
}

const StatusFilter = {
ACTIVE: true,
DEACTIVATED: false,
Expand Down Expand Up @@ -246,6 +254,10 @@ const WorkflowsView = defineComponent({
this.sourceControlStoreUnsubscribe();
},
methods: {
onFiltersUpdated(filters: Filters) {
this.filters = filters;
this.saveFiltersOnQueryString();
},
addWorkflow() {
this.uiStore.nodeViewInitialized = false;
void this.$router.push({ name: VIEWS.NEW_WORKFLOW });
Expand All @@ -272,8 +284,6 @@ const WorkflowsView = defineComponent({
filters: { tags: string[]; search: string; status: string | boolean },
matches: boolean,
): boolean {
this.saveFiltersOnQueryString();

if (this.settingsStore.areTagsEnabled && filters.tags.length > 0) {
matches =
matches &&
Expand Down Expand Up @@ -320,8 +330,7 @@ const WorkflowsView = defineComponent({
}

void this.$router.replace({
name: VIEWS.WORKFLOWS,
query,
query: Object.keys(query).length ? query : undefined,
});
},
isValidUserId(userId: string) {
Expand Down
Loading