fix: keep the workspace tab counts in sync with each section's list (#28983)

This commit is contained in:
G30
2026-08-24 17:36:12 -04:00
committed by GitHub
parent a914868e3c
commit f2313d0c72
5 changed files with 25 additions and 5 deletions
@@ -10,7 +10,7 @@
const i18n = getContext<Writable<i18nType>>('i18n');
import { WEBUI_NAME, user, workspaceActions } from '$lib/stores';
import { WEBUI_NAME, user, workspaceActions, workspaceCounts } from '$lib/stores';
import {
deleteKnowledgeById,
searchKnowledgeBases,
@@ -153,6 +153,7 @@
if (res) {
console.log(res);
total = res.total;
workspaceCounts.update((counts) => ({ ...counts, knowledge: total }));
const pageItems: KnowledgeListItem[] = res.items ?? [];
if ((pageItems ?? []).length === 0) {
+3 -1
View File
@@ -20,7 +20,8 @@
pinnedModels,
settings,
user,
workspaceActions
workspaceActions,
workspaceCounts
} from '$lib/stores';
import { WEBUI_API_BASE_URL } from '$lib/constants';
import {
@@ -165,6 +166,7 @@
if (res) {
models = res.items;
total = res.total;
workspaceCounts.update((counts) => ({ ...counts, models: total }));
// get tags
tags = await getModelTags(localStorage.token).catch((error) => {
+2 -1
View File
@@ -11,7 +11,7 @@
import { onMount, getContext, tick, onDestroy } from 'svelte';
import type { Writable } from 'svelte/store';
import type { i18n as i18nType } from 'i18next';
import { WEBUI_NAME, config, user, workspaceActions } from '$lib/stores';
import { WEBUI_NAME, config, user, workspaceActions, workspaceCounts } from '$lib/stores';
import {
createNewPrompt,
@@ -179,6 +179,7 @@
if (res) {
prompts = res.items;
total = res.total;
workspaceCounts.update((counts) => ({ ...counts, prompts: total }));
// get tags
tags = await getPromptTags(localStorage.token).catch((error) => {
+8 -1
View File
@@ -10,7 +10,13 @@
import { onMount, getContext, tick, onDestroy } from 'svelte';
const i18n = getContext('i18n');
import { WEBUI_NAME, user, skills as _skills, workspaceActions } from '$lib/stores';
import {
WEBUI_NAME,
user,
skills as _skills,
workspaceActions,
workspaceCounts
} from '$lib/stores';
import { goto } from '$app/navigation';
import {
getSkills,
@@ -117,6 +123,7 @@
if (res) {
filteredItems = res.items;
total = res.total;
workspaceCounts.update((counts) => ({ ...counts, skills: total }));
}
} catch (err) {
console.error(err);
+10 -1
View File
@@ -10,7 +10,14 @@
import { onMount, getContext, tick, onDestroy } from 'svelte';
const i18n = getContext('i18n');
import { WEBUI_NAME, config, tools as _tools, user, workspaceActions } from '$lib/stores';
import {
WEBUI_NAME,
config,
tools as _tools,
user,
workspaceActions,
workspaceCounts
} from '$lib/stores';
import { goto } from '$app/navigation';
import {
@@ -152,6 +159,8 @@
return direction * ((a.updated_at ?? 0) - (b.updated_at ?? 0));
});
workspaceCounts.update((counts) => ({ ...counts, tools: filteredItems.length }));
};
const setSortKey = (key: string) => {