-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(hydration): provide compat fallback for idle callback #11935
Conversation
❌ Deploy Preview for vue-next-template-explorer failed.
|
❌ Deploy Preview for vue-sfc-playground failed.
|
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
@vue/compat
vue
commit: |
import { DOMNodeTypes, isComment } from './hydration' | ||
|
||
const globalThis = getGlobalThis() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this into the functions where it's needed and call it inline (it's cached) so that this can be treeshaken with the functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typescript appears to have issues with this approach
// https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/app/compat/idle-callback.ts | ||
// Polyfills for Safari support | ||
// https://caniuse.com/requestidlecallback | ||
const requestIdleCallback: typeof getGlobalThis().requestIdleCallback = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should not be like this ReturnType<typeof getGlobalThis>['requestIdleCallback']
?
This PR provides a compatibility polyfill for idle callback, which is not supported in Safari. The implementation is taken straight from Nuxt's.