fix(editor): Don't show archived only hint at empty folders (#19538)

This commit is contained in:
Jaakko Husso
2025-09-15 13:35:19 +03:00
committed by GitHub
parent e589cde9c3
commit c0d5d777ca
2 changed files with 27 additions and 6 deletions

View File

@@ -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,
);

View File

@@ -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;