feat: Tag input shows already existing tags (closes #521)#522
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a richer tag editing experience in the blog post editor by introducing a TagInput component that can render existing tags as pills and show selectable suggestions, backed by a tag-usage query service with explicit cache invalidation.
Changes:
- Introduces
TagInputcomponent + styling to display existing tags as removable pills and offer suggestion selection/keyboard navigation. - Extends
ITagQueryService/TagQueryServicewithClearTagCacheAsync()and triggers tag-cache invalidation on blog post create/update/restore and on blog post deletion. - Adds/updates unit + integration tests to cover suggestion rendering and cache invalidation behavior.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/LinkDotNet.Blog.UnitTests/Web/Features/Services/Tags/TagQueryServiceTests.cs | Adds coverage for clearing the tag usage cache. |
| tests/LinkDotNet.Blog.UnitTests/Web/Features/Admin/BlogPostEditor/Components/TagInputTests.cs | New bUnit tests for tag pill rendering, suggestion selection, normalization, and keyboard behavior. |
| tests/LinkDotNet.Blog.UnitTests/Web/Features/Admin/BlogPostEditor/Components/CreateNewBlogPostTests.cs | Updates tests for new tag input mechanics and tag suggestion/cache behaviors. |
| tests/LinkDotNet.Blog.IntegrationTests/Web/Shared/Admin/BlogPostAdminActionsTests.cs | Verifies tag cache is cleared when a blog post is deleted. |
| tests/LinkDotNet.Blog.IntegrationTests/Web/Features/Admin/BlogPostEditor/UpdateBlogPostPageTests.cs | Injects ITagQueryService to satisfy new editor dependency. |
| tests/LinkDotNet.Blog.IntegrationTests/Web/Features/Admin/BlogPostEditor/CreateNewBlogPostPageTests.cs | Injects ITagQueryService and updates tag input interaction. |
| src/LinkDotNet.Blog.Web/wwwroot/css/basic.css | Adds CSS for the new tag input and suggestion dropdown. |
| src/LinkDotNet.Blog.Web/Features/ShowBlogPost/Components/BlogPostAdminActions.razor | Clears tag cache after deleting a post. |
| src/LinkDotNet.Blog.Web/Features/Services/Tags/TagQueryService.cs | Adds ClearTagCacheAsync() and tweaks cache key visibility. |
| src/LinkDotNet.Blog.Web/Features/Services/Tags/ITagQueryService.cs | Adds ClearTagCacheAsync() to the contract. |
| src/LinkDotNet.Blog.Web/Features/Admin/BlogPostEditor/Components/TagInput.razor | New tag input component with pills + suggestion UI. |
| src/LinkDotNet.Blog.Web/Features/Admin/BlogPostEditor/Components/CreateNewBlogPost.razor | Replaces raw text tags input with TagInput + loads suggestions and invalidates tag cache on changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+35
to
+39
| <button type="button" | ||
| class="list-group-item list-group-item-action @(selectedIndex == index ? "active" : "")" | ||
| @onmousedown="() => SelectSuggestionAsync(suggestion)" | ||
| @onclick="() => SelectSuggestionAsync(suggestion)" | ||
| @onmouseenter="() => selectedIndex = index"> |
Comment on lines
+30
to
+34
| @if (isOpen && GetFilteredSuggestions().Count > 0) | ||
| { | ||
| <div class="list-group position-absolute w-100 shadow mt-1 tag-input-suggestions"> | ||
| @foreach (var (suggestion, index) in GetFilteredSuggestions().Select((tag, i) => (tag, i))) | ||
| { |
3d4a50a to
1b2ada4
Compare
1b2ada4 to
8709ae5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.