Skip to content

Commit bec0fbc

Browse files
committed
fix(createVirtual): guard cancelAnimationFrame in onScopeDispose for SSR
Vue 3.5.31 now invokes scope disposal callbacks during SSR rendering. The unguarded cancelAnimationFrame calls fail in Node.js where the Web API is not available.
1 parent cee44fa commit bec0fbc

File tree

1 file changed

+2
-0
lines changed
  • packages/0/src/composables/createVirtual

1 file changed

+2
-0
lines changed

packages/0/src/composables/createVirtual/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,8 @@ export function createVirtual<T = unknown> (
654654
}
655655

656656
onScopeDispose(() => {
657+
if (!IN_BROWSER) return
658+
657659
cancelAnimationFrame(raf)
658660
cancelAnimationFrame(rebuildRaf)
659661
cancelAnimationFrame(edgeRaf)

0 commit comments

Comments
 (0)