mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-28 00:35:32 +08:00
feat(skills): 优化技能安装/卸载的缓存更新策略 (#1573)
- 修改安装、卸载、导入、ZIP安装等操作的缓存更新逻辑,从invalidateQueries改为直接setQueryData - 为已安装和可发现技能查询添加keepPreviousData和staleTime: Infinity配置 - 修复会话管理页面布局滚动问题,添加min-h-0防止内容溢出
This commit is contained in:
@@ -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">
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user