mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
fix(editor): Don't show archived only hint at empty folders (#19538)
This commit is contained in:
@@ -97,10 +97,13 @@ export const useFoldersStore = defineStore(STORES.FOLDERS, () => {
|
||||
return result;
|
||||
}
|
||||
|
||||
async function fetchTotalWorkflowsAndFoldersCount(projectId?: string): Promise<number> {
|
||||
async function fetchTotalWorkflowsAndFoldersCount(
|
||||
projectId?: string,
|
||||
parentFolderId?: string,
|
||||
): Promise<number> {
|
||||
const { count } = await workflowsApi.getWorkflowsAndFolders(
|
||||
rootStore.restApiContext,
|
||||
{ projectId },
|
||||
{ projectId, parentFolderId },
|
||||
{ skip: 0, take: 1 },
|
||||
true,
|
||||
);
|
||||
|
||||
@@ -467,7 +467,13 @@ watch(
|
||||
currentFolderId.value = newVal as string;
|
||||
filters.value.search = '';
|
||||
saveFiltersOnQueryString();
|
||||
await fetchWorkflows();
|
||||
await Promise.all([
|
||||
fetchWorkflows(),
|
||||
foldersStore.fetchTotalWorkflowsAndFoldersCount(
|
||||
route.params.projectId as string | undefined,
|
||||
currentFolderId.value ?? undefined,
|
||||
),
|
||||
]);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -479,7 +485,10 @@ sourceControlStore.$onAction(({ name, after }) => {
|
||||
const refreshWorkflows = async () => {
|
||||
await Promise.all([
|
||||
fetchWorkflows(),
|
||||
foldersStore.fetchTotalWorkflowsAndFoldersCount(route.params.projectId as string | undefined),
|
||||
foldersStore.fetchTotalWorkflowsAndFoldersCount(
|
||||
route.params.projectId as string | undefined,
|
||||
currentFolderId.value ?? undefined,
|
||||
),
|
||||
]);
|
||||
};
|
||||
|
||||
@@ -490,11 +499,17 @@ const onFolderDeleted = async (payload: {
|
||||
}) => {
|
||||
const folderInfo = foldersStore.getCachedFolder(payload.folderId);
|
||||
foldersStore.deleteFoldersFromCache([payload.folderId, folderInfo?.parentFolder ?? '']);
|
||||
// If the deleted folder is the current folder, navigate to the parent folder
|
||||
|
||||
const nextFolderId =
|
||||
currentFolderId.value === payload.folderId
|
||||
? (folderInfo?.parentFolder ?? null)
|
||||
: currentFolderId.value;
|
||||
await foldersStore.fetchTotalWorkflowsAndFoldersCount(
|
||||
route.params.projectId as string | undefined,
|
||||
nextFolderId ?? undefined,
|
||||
);
|
||||
|
||||
// If the deleted folder is the current folder, navigate to the parent folder
|
||||
if (currentFolderId.value === payload.folderId) {
|
||||
void router.push({
|
||||
name: VIEWS.PROJECTS_FOLDERS,
|
||||
@@ -564,7 +579,10 @@ const initialize = async () => {
|
||||
fetchWorkflows(),
|
||||
workflowsStore.fetchActiveWorkflows(),
|
||||
usageStore.getLicenseInfo(),
|
||||
foldersStore.fetchTotalWorkflowsAndFoldersCount(route.params.projectId as string | undefined),
|
||||
foldersStore.fetchTotalWorkflowsAndFoldersCount(
|
||||
route.params.projectId as string | undefined,
|
||||
currentFolderId.value ?? undefined,
|
||||
),
|
||||
]);
|
||||
breadcrumbsLoading.value = false;
|
||||
workflowsAndFolders.value = resourcesPage;
|
||||
|
||||
Reference in New Issue
Block a user