Skip to content

Commit 2941e15

Browse files
committed
Fix route not being bookmarkable when reloading app on a bookmarkable page
1 parent d6329af commit 2941e15

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/renderer/components/top-nav/top-nav.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,25 +155,24 @@ export default defineComponent({
155155
}
156156
},
157157
watch: {
158-
$route: function (to, from) {
158+
$route: function (to) {
159159
this.setNavigationHistoryDropdownOptions()
160160
if ('navigation' in window) {
161161
this.isArrowForwardDisabled = !window.navigation.canGoForward
162162
this.isArrowBackwardDisabled = !window.navigation.canGoBack
163163
}
164164

165-
this.currentRouteFullPath = to.fullPath
166-
167-
// only allow page bookmarking on routes where it can be relevant to do so
168-
this.isRouteBookmarkable = this.allowedPageBookmarkRouteMetaTitles.includes(to.meta.title)
165+
this.setCurrentRoute(to)
169166
}
170167
},
171168
mounted: function () {
172169
let previousWidth = window.innerWidth
173170
if (window.innerWidth <= MOBILE_WIDTH_THRESHOLD) {
174171
this.showSearchContainer = false
175172
}
176-
this.currentRouteFullPath = this.$router.currentRoute.fullPath
173+
174+
this.$router.onReady(() => this.setCurrentRoute(this.$router.currentRoute))
175+
177176
// Store is not up-to-date when the component mounts, so we use timeout.
178177
setTimeout(() => {
179178
if (this.expandSideBar) {
@@ -193,6 +192,11 @@ export default defineComponent({
193192
this.debounceSearchResults = debounce(this.getSearchSuggestions, 200)
194193
},
195194
methods: {
195+
setCurrentRoute: function (route) {
196+
this.currentRouteFullPath = route.fullPath
197+
// only allow page bookmarking on routes where it can be relevant to do so
198+
this.isRouteBookmarkable = this.allowedPageBookmarkRouteMetaTitles.includes(route.meta.title)
199+
},
196200
goToSearch: async function (queryText, { event }) {
197201
const doCreateNewWindow = event && event.shiftKey
198202

0 commit comments

Comments
 (0)