mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-24 22:55:13 +00:00
fix(vue-app): don't throw if we can't read sessionStorage
(#27662)
This commit is contained in:
parent
7cec79c437
commit
a8a74a91a2
@ -157,13 +157,16 @@ export function resolveRouteComponents (route, fn) {
|
|||||||
window.sessionStorage
|
window.sessionStorage
|
||||||
) {
|
) {
|
||||||
const timeNow = Date.now()
|
const timeNow = Date.now()
|
||||||
|
try {
|
||||||
const previousReloadTime = parseInt(window.sessionStorage.getItem('nuxt-reload'))
|
const previousReloadTime = parseInt(window.sessionStorage.getItem('nuxt-reload'))
|
||||||
|
|
||||||
// check for previous reload time not to reload infinitely
|
// check for previous reload time not to reload infinitely
|
||||||
if (!previousReloadTime || previousReloadTime + 60000 < timeNow) {
|
if (!previousReloadTime || previousReloadTime + 60000 < timeNow) {
|
||||||
window.sessionStorage.setItem('nuxt-reload', timeNow)
|
window.sessionStorage.setItem('nuxt-reload', timeNow)
|
||||||
window.location.reload(true /* skip cache */)
|
window.location.reload(true /* skip cache */)
|
||||||
}
|
}
|
||||||
|
} catch {
|
||||||
|
// don't throw an error if we have issues reading sessionStorage
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw error
|
throw error
|
||||||
|
Loading…
Reference in New Issue
Block a user