Skip to content

Commit 056005d

Browse files
authored
Add authorId to internal post URL when it is missing (#5825)
1 parent ecb2d7d commit 056005d

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/renderer/views/Post/Post.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default defineComponent({
3535
}
3636
},
3737
watch: {
38-
async $route() {
38+
async '$route.params.id'() {
3939
// react to route changes...
4040
this.isLoading = true
4141
if (this.isInvidiousAllowed) {
@@ -57,6 +57,18 @@ export default defineComponent({
5757
this.post = await getInvidiousCommunityPost(this.id, this.authorId)
5858
this.authorId = this.post.authorId
5959
this.isLoading = false
60+
61+
// If the authorId is missing from the URL we should add it,
62+
// that way if the user comes back to this page by pressing the back button
63+
// we don't have to resolve the authorId again
64+
if (this.authorId !== this.$route.query.authorId) {
65+
this.$router.replace({
66+
path: `/post/${this.id}`,
67+
query: {
68+
authorId: this.authorId
69+
}
70+
})
71+
}
6072
}
6173
}
6274
})

0 commit comments

Comments
 (0)