mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-29 09:02:03 +00:00
fix(nuxt): only request animation frame on client (#25569)
This commit is contained in:
parent
2364aabe93
commit
10f2356ab4
@ -79,7 +79,9 @@ function createLoadingIndicator (opts: Partial<LoadingIndicatorOpts> = {}) {
|
||||
|
||||
function clear () {
|
||||
clearTimeout(_throttle)
|
||||
if (import.meta.client) {
|
||||
cancelAnimationFrame(rafId)
|
||||
}
|
||||
_throttle = null
|
||||
}
|
||||
|
||||
@ -93,8 +95,10 @@ function createLoadingIndicator (opts: Partial<LoadingIndicatorOpts> = {}) {
|
||||
startTimeStamp ??= timeStamp
|
||||
const elapsed = timeStamp - startTimeStamp
|
||||
progress.value = Math.max(0, Math.min(100, getProgress(duration, elapsed)))
|
||||
if (import.meta.client) {
|
||||
rafId = requestAnimationFrame(step)
|
||||
}
|
||||
}
|
||||
|
||||
if (import.meta.client) {
|
||||
rafId = requestAnimationFrame(step)
|
||||
|
Loading…
Reference in New Issue
Block a user