Skip to content

Commit

Permalink
fix(hydration): provide compat fallback for idle callback hydration s…
Browse files Browse the repository at this point in the history
…trategy (#11935)
  • Loading branch information
GalacticHypernova authored Oct 11, 2024
1 parent 05685a9 commit 1ae545a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/runtime-core/src/hydrationStrategies.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { isString } from '@vue/shared'
import { getGlobalThis, isString } from '@vue/shared'
import { DOMNodeTypes, isComment } from './hydration'

// Polyfills for Safari support
// see https://caniuse.com/requestidlecallback
const requestIdleCallback: Window['requestIdleCallback'] =
getGlobalThis().requestIdleCallback || (cb => setTimeout(cb, 1))
const cancelIdleCallback: Window['cancelIdleCallback'] =
getGlobalThis().cancelIdleCallback || (id => clearTimeout(id))

/**
* A lazy hydration strategy for async components.
* @param hydrate - call this to perform the actual hydration.
Expand Down

0 comments on commit 1ae545a

Please sign in to comment.