mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-28 16:42:04 +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,12 +157,15 @@ export function resolveRouteComponents (route, fn) {
|
|||||||
window.sessionStorage
|
window.sessionStorage
|
||||||
) {
|
) {
|
||||||
const timeNow = Date.now()
|
const timeNow = Date.now()
|
||||||
const previousReloadTime = parseInt(window.sessionStorage.getItem('nuxt-reload'))
|
try {
|
||||||
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user