Skip to content

Commit

Permalink
Add authorId to internal post URL when it is missing (#5825)
Browse files Browse the repository at this point in the history
  • Loading branch information
absidue authored Oct 6, 2024
1 parent ecb2d7d commit 056005d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/renderer/views/Post/Post.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default defineComponent({
}
},
watch: {
async $route() {
async '$route.params.id'() {
// react to route changes...
this.isLoading = true
if (this.isInvidiousAllowed) {
Expand All @@ -57,6 +57,18 @@ export default defineComponent({
this.post = await getInvidiousCommunityPost(this.id, this.authorId)
this.authorId = this.post.authorId
this.isLoading = false

// If the authorId is missing from the URL we should add it,
// that way if the user comes back to this page by pressing the back button
// we don't have to resolve the authorId again
if (this.authorId !== this.$route.query.authorId) {
this.$router.replace({
path: `/post/${this.id}`,
query: {
authorId: this.authorId
}
})
}
}
}
})

0 comments on commit 056005d

Please sign in to comment.