feat(skills): 优化技能安装/卸载的缓存更新策略 (#1573)

- 修改安装、卸载、导入、ZIP安装等操作的缓存更新逻辑,从invalidateQueries改为直接setQueryData
- 为已安装和可发现技能查询添加keepPreviousData和staleTime: Infinity配置
- 修复会话管理页面布局滚动问题,添加min-h-0防止内容溢出
This commit is contained in:
TangZhiZzz
2026-03-23 16:05:13 +08:00
committed by GitHub
parent bd3cfb7741
commit 8aa6ec784b
3 changed files with 108 additions and 19 deletions
@@ -208,12 +208,15 @@ export function SessionManagerPage({ appId }: { appId: string }) {
return (
<TooltipProvider>
<div className="mx-auto px-4 sm:px-6 flex flex-col flex-1 min-h-0">
<div
className="mx-auto px-4 sm:px-6 flex flex-col h-full min-h-0"
onWheel={(e) => e.stopPropagation()}
>
<div className="flex-1 overflow-hidden flex flex-col gap-4">
{/* 主内容区域 - 左右分栏 */}
<div className="flex-1 overflow-hidden grid gap-4 md:grid-cols-[320px_1fr]">
{/* 左侧会话列表 */}
<Card className="flex flex-col overflow-hidden">
<Card className="flex flex-col flex-1 min-h-0 overflow-hidden">
<CardHeader className="py-2 px-3 border-b">
{isSearchOpen ? (
<div className="relative flex-1">
@@ -387,7 +390,7 @@ export function SessionManagerPage({ appId }: { appId: string }) {
</div>
)}
</CardHeader>
<CardContent className="flex-1 overflow-hidden p-0">
<CardContent className="flex-1 min-h-0 p-0">
<ScrollArea className="h-full">
<div className="p-2">
{isLoading ? (
@@ -605,7 +608,7 @@ export function SessionManagerPage({ appId }: { appId: string }) {
</CardHeader>
{/* 消息列表区域 */}
<CardContent className="flex-1 overflow-hidden p-0">
<CardContent className="flex-1 min-h-0 p-0">
<div className="flex h-full min-w-0">
{/* 消息列表 */}
<ScrollArea className="flex-1 min-w-0">
+10 -1
View File
@@ -110,7 +110,16 @@ const UnifiedSkillsPanel = React.forwardRef<
message: t("skills.uninstallConfirm", { name: skill.name }),
onConfirm: async () => {
try {
const result = await uninstallMutation.mutateAsync(skill.id);
// 构建 skillKey 用于更新 discoverable 缓存
const installName =
skill.directory.split(/[/\\]/).pop()?.toLowerCase() ||
skill.directory.toLowerCase();
const skillKey = `${installName}:${skill.repoOwner?.toLowerCase() || ""}:${skill.repoName?.toLowerCase() || ""}`;
const result = await uninstallMutation.mutateAsync({
id: skill.id,
skillKey,
});
setConfirmDialog(null);
toast.success(t("skills.uninstallSuccess", { name: skill.name }), {
description: result.backupPath