@@ -155,25 +155,24 @@ export default defineComponent({
155
155
}
156
156
} ,
157
157
watch : {
158
- $route : function ( to , from ) {
158
+ $route : function ( to ) {
159
159
this . setNavigationHistoryDropdownOptions ( )
160
160
if ( 'navigation' in window ) {
161
161
this . isArrowForwardDisabled = ! window . navigation . canGoForward
162
162
this . isArrowBackwardDisabled = ! window . navigation . canGoBack
163
163
}
164
164
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 )
169
166
}
170
167
} ,
171
168
mounted : function ( ) {
172
169
let previousWidth = window . innerWidth
173
170
if ( window . innerWidth <= MOBILE_WIDTH_THRESHOLD ) {
174
171
this . showSearchContainer = false
175
172
}
176
- this . currentRouteFullPath = this . $router . currentRoute . fullPath
173
+
174
+ this . $router . onReady ( ( ) => this . setCurrentRoute ( this . $router . currentRoute ) )
175
+
177
176
// Store is not up-to-date when the component mounts, so we use timeout.
178
177
setTimeout ( ( ) => {
179
178
if ( this . expandSideBar ) {
@@ -193,6 +192,11 @@ export default defineComponent({
193
192
this . debounceSearchResults = debounce ( this . getSearchSuggestions , 200 )
194
193
} ,
195
194
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
+ } ,
196
200
goToSearch : async function ( queryText , { event } ) {
197
201
const doCreateNewWindow = event && event . shiftKey
198
202
0 commit comments