Skip to content

Commit

Permalink
fix: hydration issue
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Jan 15, 2024
1 parent b8ae5f0 commit c2f68ba
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions components/pages/home/FeaturedTags.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
}[]
}>()
// TODO: Figure out how to make this reload on page reload
const preselectedTags = props.tags.map((tag) => ({
...tag,
images: [getRandomImage(tag.images)]
}))
const preselectedTags = useState('preselectedTags' + props.tags[0].path)
callOnce(() => {
preselectedTags.value = props.tags.map((tag) => ({
...tag,
images: [getRandomImage(tag.images)]
}))
})
function getRandomImage(images: string[]) {
return images[Math.floor(Math.random() * images.length)]
Expand Down

0 comments on commit c2f68ba

Please sign in to comment.