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

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
This commit is contained in:
oleg 2024-01-30 12:00:10 +01:00 committed by GitHub
parent 327cc8df73
commit 79c9763122
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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">
@ -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,
@ -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 });
@ -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 &&
@ -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) {