mirror of
https://github.com/n8n-io/n8n.git
synced 2024-09-19 22:37:31 -07:00
fix(editor): Persist tag filter when clicking tag directly in workflows page (#9709)
This commit is contained in:
parent
f9aa340015
commit
0502738c0d
|
@ -21,6 +21,8 @@ describe('WorkflowsView', () => {
|
||||||
let usersStore: ReturnType<typeof useUsersStore>;
|
let usersStore: ReturnType<typeof useUsersStore>;
|
||||||
let projectsStore: ReturnType<typeof useProjectsStore>;
|
let projectsStore: ReturnType<typeof useProjectsStore>;
|
||||||
|
|
||||||
|
const routerReplaceMock = vi.fn();
|
||||||
|
|
||||||
const renderComponent = createComponentRenderer(WorkflowsView, {
|
const renderComponent = createComponentRenderer(WorkflowsView, {
|
||||||
global: {
|
global: {
|
||||||
mocks: {
|
mocks: {
|
||||||
|
@ -29,7 +31,7 @@ describe('WorkflowsView', () => {
|
||||||
params: {},
|
params: {},
|
||||||
},
|
},
|
||||||
$router: {
|
$router: {
|
||||||
replace: vi.fn(),
|
replace: routerReplaceMock,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -90,11 +92,13 @@ describe('WorkflowsView', () => {
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(getAllByTestId('resources-list-item').length).toBeLessThan(5);
|
expect(getAllByTestId('resources-list-item').length).toBeLessThan(5);
|
||||||
});
|
});
|
||||||
|
expect(routerReplaceMock).toHaveBeenLastCalledWith({ query: { tags: '1' } });
|
||||||
|
|
||||||
await userEvent.click(getByTestId('workflows-filter-reset'));
|
await userEvent.click(getByTestId('workflows-filter-reset'));
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(getAllByTestId('resources-list-item')).toHaveLength(5);
|
expect(getAllByTestId('resources-list-item')).toHaveLength(5);
|
||||||
});
|
});
|
||||||
|
expect(routerReplaceMock).toHaveBeenLastCalledWith({ query: undefined });
|
||||||
|
|
||||||
await userEvent.click(
|
await userEvent.click(
|
||||||
getAllByTestId('resources-list-item')[3].querySelector('.n8n-tag') as HTMLElement,
|
getAllByTestId('resources-list-item')[3].querySelector('.n8n-tag') as HTMLElement,
|
||||||
|
@ -102,5 +106,6 @@ describe('WorkflowsView', () => {
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(getAllByTestId('resources-list-item').length).toBeLessThan(5);
|
expect(getAllByTestId('resources-list-item').length).toBeLessThan(5);
|
||||||
});
|
});
|
||||||
|
expect(routerReplaceMock).toHaveBeenLastCalledWith({ query: { tags: '1' } });
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -269,6 +269,12 @@ const WorkflowsView = defineComponent({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
filters: {
|
||||||
|
deep: true,
|
||||||
|
handler() {
|
||||||
|
this.saveFiltersOnQueryString();
|
||||||
|
},
|
||||||
|
},
|
||||||
'filters.tags'() {
|
'filters.tags'() {
|
||||||
this.sendFiltersTelemetry('tags');
|
this.sendFiltersTelemetry('tags');
|
||||||
},
|
},
|
||||||
|
@ -295,7 +301,6 @@ const WorkflowsView = defineComponent({
|
||||||
methods: {
|
methods: {
|
||||||
onFiltersUpdated(filters: Filters) {
|
onFiltersUpdated(filters: Filters) {
|
||||||
this.filters = filters;
|
this.filters = filters;
|
||||||
this.saveFiltersOnQueryString();
|
|
||||||
},
|
},
|
||||||
addWorkflow() {
|
addWorkflow() {
|
||||||
this.uiStore.nodeViewInitialized = false;
|
this.uiStore.nodeViewInitialized = false;
|
||||||
|
|
Loading…
Reference in a new issue