mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +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)
|
||||
cancelAnimationFrame(rafId)
|
||||
if (import.meta.client) {
|
||||
cancelAnimationFrame(rafId)
|
||||
}
|
||||
_throttle = null
|
||||
}
|
||||
|
||||
@ -93,7 +95,9 @@ function createLoadingIndicator (opts: Partial<LoadingIndicatorOpts> = {}) {
|
||||
startTimeStamp ??= timeStamp
|
||||
const elapsed = timeStamp - startTimeStamp
|
||||
progress.value = Math.max(0, Math.min(100, getProgress(duration, elapsed)))
|
||||
rafId = requestAnimationFrame(step)
|
||||
if (import.meta.client) {
|
||||
rafId = requestAnimationFrame(step)
|
||||
}
|
||||
}
|
||||
|
||||
if (import.meta.client) {
|
||||
|
Loading…
Reference in New Issue
Block a user