Skip to content

fix: explain blocklist-hidden results on posts page#96

Open
AlejandroAkbal wants to merge 1 commit intomainfrom
auto-triage/212-hiding-blocking-tags
Open

fix: explain blocklist-hidden results on posts page#96
AlejandroAkbal wants to merge 1 commit intomainfrom
auto-triage/212-hiding-blocking-tags

Conversation

@AlejandroAkbal
Copy link
Member

@AlejandroAkbal AlejandroAkbal commented Mar 14, 2026

Summary

  • avoid throwing a hard error when a selected tag is blocked; return an empty page response instead
  • keep initial error UI for real fetch failures only, and show blocklist-aware empty-state messaging when results are hidden by blocklist rules
  • clarify why users see no posts despite tag counts, matching feedback issue 212

Validation

  • pnpm exec nuxi typecheck (fails due to extensive pre-existing repo-wide type/module issues unrelated to this change)

Feedback issue: https://feedback.r34.app/p/posts/212/hiding-blocking-tags

Summary by CodeRabbit

  • Bug Fixes

    • Fixed error when selecting blocklisted tags; now displays gracefully with contextual messaging
  • User Experience

    • Added context-aware messages indicating when content is blocked or hidden by tag filters
    • Improved feedback clarity for empty search results

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 14, 2026

Walkthrough

Single file modification that changes error handling for blocklisted tags in post data loading. When a blocklisted tag is selected, fetchPosts now returns an empty response instead of throwing an error, with context-sensitive UI messaging reflecting the blocked or hidden state.

Changes

Cohort / File(s) Summary
Blocked Tag Handling
pages/posts/[domain].vue
Modified fetchPosts to gracefully handle blocklisted tags by returning empty IPostPage structure instead of throwing errors. Added two computed flags: isBlockedTagSelected (detects blocklisted tags in selection) and hasHiddenPosts (detects pages with counted items but no data). Updated error template condition and expanded no-results template with context-aware messages for blocked tags, hidden posts, or generic filtering suggestions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main change: adding explanatory messaging for blocklist-hidden results on the posts page.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch auto-triage/212-hiding-blocking-tags
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch auto-triage/212-hiding-blocking-tags
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@pages/posts/`[domain].vue:
- Around line 389-405: The synthetic empty IPostPage return object in
pages/posts/[domain].vue currently sets links.prev and links.next to empty
strings which pagination logic treats as truthy; update that returned object
(the literal cast to IPostPage) so that links.prev and links.next are null
(sentinel for “no page”) instead of '' to ensure previous/next page checks
behave correctly; keep other fields unchanged.
- Around line 589-594: The blocklist comparison in the computed
isBlockedTagSelected uses raw string comparisons which are case-sensitive;
update the predicate to normalize casing (e.g., toLowerCase()) for both the
selectedBlockList entries and tag names before comparing, extract and reuse that
predicate function (e.g., normalizeAndMatches(blockTag, tag)) so other blocklist
checks use the same logic, and update references to selectedBlockList,
selectedTags, and isBlockedTagSelected to call the normalized comparison to
avoid case-mismatch misses.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5b67ffdb-2d09-42c7-bdac-9353a782915f

📥 Commits

Reviewing files that changed from the base of the PR and between 5cc34fe and 90d6c1f.

📒 Files selected for processing (1)
  • pages/posts/[domain].vue

Comment on lines +389 to +405
return {
data: [],
meta: {
items_count: 0,
total_items: 0,
current_page: 0,
total_pages: 0,
items_per_page: 0
},
links: {
self: '',
first: '',
last: '',
prev: '',
next: ''
}
} as IPostPage
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Use null sentinels for prev/next in the synthetic empty page.

Line 402-Line 403 currently return empty strings, but pagination logic treats only null/undefined as “no page”. This can make previous-page state incorrect for blocklisted queries.

Proposed fix
         links: {
           self: '',
           first: '',
           last: '',
-          prev: '',
-          next: ''
+          prev: null,
+          next: null
         }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return {
data: [],
meta: {
items_count: 0,
total_items: 0,
current_page: 0,
total_pages: 0,
items_per_page: 0
},
links: {
self: '',
first: '',
last: '',
prev: '',
next: ''
}
} as IPostPage
return {
data: [],
meta: {
items_count: 0,
total_items: 0,
current_page: 0,
total_pages: 0,
items_per_page: 0
},
links: {
self: '',
first: '',
last: '',
prev: null,
next: null
}
} as IPostPage
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pages/posts/`[domain].vue around lines 389 - 405, The synthetic empty
IPostPage return object in pages/posts/[domain].vue currently sets links.prev
and links.next to empty strings which pagination logic treats as truthy; update
that returned object (the literal cast to IPostPage) so that links.prev and
links.next are null (sentinel for “no page”) instead of '' to ensure
previous/next page checks behave correctly; keep other fields unchanged.

Comment on lines +589 to +594
const isBlockedTagSelected = computed(() => {
return (
selectedBlockList.value.length > 0 &&
selectedBlockList.value.some((blocklistTag) => selectedTags.value.map((tag) => tag.name).includes(blocklistTag))
)
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Normalize tag casing before blocklist comparisons.

Line 592 compares raw strings. Because blocklist entries and query tags can differ by case, blocked tags can be missed. Please normalize both sides (e.g., lowercase) and reuse the same predicate in all blocklist checks to avoid behavior drift.

Proposed fix
+  const selectedTagNameSet = computed(() => new Set(selectedTags.value.map((tag) => tag.name.toLowerCase())))
+
   const isBlockedTagSelected = computed(() => {
-    return (
-      selectedBlockList.value.length > 0 &&
-      selectedBlockList.value.some((blocklistTag) => selectedTags.value.map((tag) => tag.name).includes(blocklistTag))
-    )
+    return selectedBlockList.value.some((blocklistTag) => selectedTagNameSet.value.has(blocklistTag.toLowerCase()))
   })
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const isBlockedTagSelected = computed(() => {
return (
selectedBlockList.value.length > 0 &&
selectedBlockList.value.some((blocklistTag) => selectedTags.value.map((tag) => tag.name).includes(blocklistTag))
)
})
const selectedTagNameSet = computed(() => new Set(selectedTags.value.map((tag) => tag.name.toLowerCase())))
const isBlockedTagSelected = computed(() => {
return selectedBlockList.value.some((blocklistTag) => selectedTagNameSet.value.has(blocklistTag.toLowerCase()))
})
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pages/posts/`[domain].vue around lines 589 - 594, The blocklist comparison in
the computed isBlockedTagSelected uses raw string comparisons which are
case-sensitive; update the predicate to normalize casing (e.g., toLowerCase())
for both the selectedBlockList entries and tag names before comparing, extract
and reuse that predicate function (e.g., normalizeAndMatches(blockTag, tag)) so
other blocklist checks use the same logic, and update references to
selectedBlockList, selectedTags, and isBlockedTagSelected to call the normalized
comparison to avoid case-mismatch misses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant