Skip to content

Commit 6e4c776

Browse files
authored
fix: Show tag button adding containers with tags from library [FC-0123] (#3017)
1 parent 9d5ba98 commit 6e4c776

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/course-outline/data/apiHooks.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ export const useCreateCourseBlock = (
128128
queryKey: courseOutlineQueryKeys.courseDetails(getCourseKey(data.locator)),
129129
});
130130
await invalidateParentQueries(queryClient, variables);
131+
// Invalidate tags count for the newly created block
132+
// Strips "+type@<blockType>+block@<id>" to produce a course-run wildcard, e.g.
133+
// "block-v1:org+course+run+type@vertical+block@abc" → "block-v1:org+course+run*"
134+
const contentPattern = data.locator.replace(/\+type@.*$/, '*');
135+
queryClient.invalidateQueries({ queryKey: ['contentTagsCount', contentPattern] });
131136
// scroll to newly added block
132137
setData({ id: data.locator });
133138
// if newly created block is chapter or section, fetch and add it to store

0 commit comments

Comments
 (0)