Skip to content

Commit

Permalink
fix(saved posts): re-render posts with different keys
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Jul 23, 2024
1 parent 9b192d8 commit b8db62a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pages/premium/saved-posts/[domain].vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
return tags
.split('|')
.map((tag) => decodeURIComponent(tag))
.map((tag) => new Tag({ name: tag }))
.map((tag) => new Tag({ name: tag }).toJSON())
})
const selectedPage = computed(() => {
Expand Down Expand Up @@ -123,7 +123,7 @@
icon: Bars3BottomRightIcon,
options: [
{ label: 'Sort', value: undefined },
{ label: 'Score', value: 'score' },
{ label: 'Score', value: '-score' },
{ label: 'Score (asc)', value: 'score' },
{ label: 'Created', value: '-created' },
{ label: 'Created (asc)', value: 'created' },
Expand Down Expand Up @@ -215,6 +215,8 @@
}
const {
suspense,
data,
error,
refetch,
Expand Down Expand Up @@ -250,6 +252,10 @@
// }
})
onServerPrefetch(async () => {
await suspense()
})
const allRows = computed<IPost[]>(() => {
if (!data.value) {
return []
Expand Down Expand Up @@ -699,7 +705,9 @@
</button>
<!-- Post -->
<!-- Fix: use domain + post.id as unique key, since virtualRow.index could be the same on different Boorus/pages -->
<PostComponent
:key="allRows[virtualRow.index].domain + '-' + allRows[virtualRow.index].id"
:post="allRows[virtualRow.index]"
:selected-tags="selectedTags"
@addTag="onPostAddTag"
Expand Down

0 comments on commit b8db62a

Please sign in to comment.