Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 41 additions & 3 deletions pages/posts/[domain].vue
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,23 @@
// selectedTags.value.some((tag) => selectedBlockList.value.includes(tag.name)) &&
selectedBlockList.value.some((blocklistTag) => selectedTags.value.map((tag) => tag.name).includes(blocklistTag))
) {
throw new Error('One of your selected tags is in the tag block list')
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
Comment on lines +389 to +405
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.

}

if (options.pageParam) {
Expand Down Expand Up @@ -570,6 +586,18 @@
})
})

const isBlockedTagSelected = computed(() => {
return (
selectedBlockList.value.length > 0 &&
selectedBlockList.value.some((blocklistTag) => selectedTags.value.map((tag) => tag.name).includes(blocklistTag))
)
})
Comment on lines +589 to +594
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.


const hasHiddenPosts = computed(() => {
if (!data.value) return false
return data.value.pages.some((page) => page.meta.items_count > 0 && page.data.length === 0)
})

const parentRef = ref<HTMLElement | null>(null)
const parentOffsetRef = ref(0)

Expand Down Expand Up @@ -958,7 +986,7 @@
</template>

<!-- Error (initial load only) -->
<template v-else-if="isError && !allRows.length">
<template v-else-if="isError && !allRows.length && !isBlockedTagSelected && !hasHiddenPosts">
<PostPageError
:error="error"
:on-retry="onRetryClick"
Expand All @@ -976,7 +1004,17 @@

<h3 class="text-lg leading-10 font-semibold">No results</h3>

<span class="w-full overflow-x-auto text-pretty">Try changing the tags or filters</span>
<span class="w-full overflow-x-auto text-pretty">
<template v-if="isBlockedTagSelected">
Your selected tag is in your blocklist
</template>
<template v-else-if="hasHiddenPosts">
Results were hidden by your tag blocklist
</template>
<template v-else>
Try changing the tags or filters
</template>
</span>
</div>
</template>

Expand Down