mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-09 22:24:05 -08: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 projectsStore: ReturnType<typeof useProjectsStore>;
|
||||
|
||||
const routerReplaceMock = vi.fn();
|
||||
|
||||
const renderComponent = createComponentRenderer(WorkflowsView, {
|
||||
global: {
|
||||
mocks: {
|
||||
|
@ -29,7 +31,7 @@ describe('WorkflowsView', () => {
|
|||
params: {},
|
||||
},
|
||||
$router: {
|
||||
replace: vi.fn(),
|
||||
replace: routerReplaceMock,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -90,11 +92,13 @@ describe('WorkflowsView', () => {
|
|||
await waitFor(() => {
|
||||
expect(getAllByTestId('resources-list-item').length).toBeLessThan(5);
|
||||
});
|
||||
expect(routerReplaceMock).toHaveBeenLastCalledWith({ query: { tags: '1' } });
|
||||
|
||||
await userEvent.click(getByTestId('workflows-filter-reset'));
|
||||
await waitFor(() => {
|
||||
expect(getAllByTestId('resources-list-item')).toHaveLength(5);
|
||||
});
|
||||
expect(routerReplaceMock).toHaveBeenLastCalledWith({ query: undefined });
|
||||
|
||||
await userEvent.click(
|
||||
getAllByTestId('resources-list-item')[3].querySelector('.n8n-tag') as HTMLElement,
|
||||
|
@ -102,5 +106,6 @@ describe('WorkflowsView', () => {
|
|||
await waitFor(() => {
|
||||
expect(getAllByTestId('resources-list-item').length).toBeLessThan(5);
|
||||
});
|
||||
expect(routerReplaceMock).toHaveBeenLastCalledWith({ query: { tags: '1' } });
|
||||
});
|
||||
});
|
|
@ -269,6 +269,12 @@ const WorkflowsView = defineComponent({
|
|||
},
|
||||
},
|
||||
watch: {
|
||||
filters: {
|
||||
deep: true,
|
||||
handler() {
|
||||
this.saveFiltersOnQueryString();
|
||||
},
|
||||
},
|
||||
'filters.tags'() {
|
||||
this.sendFiltersTelemetry('tags');
|
||||
},
|
||||
|
@ -295,7 +301,6 @@ const WorkflowsView = defineComponent({
|
|||
methods: {
|
||||
onFiltersUpdated(filters: Filters) {
|
||||
this.filters = filters;
|
||||
this.saveFiltersOnQueryString();
|
||||
},
|
||||
addWorkflow() {
|
||||
this.uiStore.nodeViewInitialized = false;
|
||||
|
|
Loading…
Reference in a new issue