From 33d5f6985d9a7754d4df4811106532ba499fc40f Mon Sep 17 00:00:00 2001 From: Fan <53250672+fzzv@users.noreply.github.com> Date: Sat, 7 Mar 2026 21:59:33 +0800 Subject: [PATCH] fix: skills count not displaying when adding (#1295) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: skills count not displaying when adding * fix: get real skill count by awaiting discovery after adding repo The previous approach computed count before discovery, so it was always 0. Now we await refetchDiscoverable() after the mutation, then filter the fresh skills list to get the actual count for the toast message. Also reverts the SkillRepo.count field — keep the interface clean since count is a transient UI concern, not a data model property. --------- Co-authored-by: Jason --- src/components/skills/SkillsPage.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/skills/SkillsPage.tsx b/src/components/skills/SkillsPage.tsx index 3fa2c3f5e..0bdcd3b4c 100644 --- a/src/components/skills/SkillsPage.tsx +++ b/src/components/skills/SkillsPage.tsx @@ -164,10 +164,20 @@ export const SkillsPage = forwardRef( const handleAddRepo = async (repo: SkillRepo) => { try { await addRepoMutation.mutateAsync(repo); + // Await discovery so we can report the real count + const { data: freshSkills } = await refetchDiscoverable(); + const count = + freshSkills?.filter( + (s) => + s.repoOwner === repo.owner && + s.repoName === repo.name && + (s.repoBranch || "main") === (repo.branch || "main"), + ).length ?? 0; toast.success( t("skills.repo.addSuccess", { owner: repo.owner, name: repo.name, + count, }), { closeButton: true }, );