|
|
@@ -1,38 +1,8 @@
|
|
|
-import type { Scheduler } from '@vue/reactivity'
|
|
|
+import type { Scheduler, SchedulerJob } from '@vue/reactivity'
|
|
|
import type { ComponentInternalInstance } from './component'
|
|
|
import { isArray } from '@vue/shared'
|
|
|
|
|
|
-export interface SchedulerJob extends Function {
|
|
|
- id?: number
|
|
|
- pre?: boolean
|
|
|
- active?: boolean
|
|
|
- computed?: boolean
|
|
|
- /**
|
|
|
- * Indicates whether the effect is allowed to recursively trigger itself
|
|
|
- * when managed by the scheduler.
|
|
|
- *
|
|
|
- * By default, a job cannot trigger itself because some built-in method calls,
|
|
|
- * e.g. Array.prototype.push actually performs reads as well (#1740) which
|
|
|
- * can lead to confusing infinite loops.
|
|
|
- * The allowed cases are component update functions and watch callbacks.
|
|
|
- * Component update functions may update child component props, which in turn
|
|
|
- * trigger flush: "pre" watch callbacks that mutates state that the parent
|
|
|
- * relies on (#1801). Watch callbacks doesn't track its dependencies so if it
|
|
|
- * triggers itself again, it's likely intentional and it is the user's
|
|
|
- * responsibility to perform recursive state mutation that eventually
|
|
|
- * stabilizes (#1727).
|
|
|
- */
|
|
|
- allowRecurse?: boolean
|
|
|
- /**
|
|
|
- * Attached by renderer.ts when setting up a component's render effect
|
|
|
- * Used to obtain component information when reporting max recursive updates.
|
|
|
- * dev only.
|
|
|
- */
|
|
|
- ownerInstance?: ComponentInternalInstance
|
|
|
-}
|
|
|
-
|
|
|
export type SchedulerJobs = SchedulerJob | SchedulerJob[]
|
|
|
-
|
|
|
export type QueueEffect = (
|
|
|
cb: SchedulerJobs,
|
|
|
suspense: ComponentInternalInstance | null,
|
|
|
@@ -210,7 +180,7 @@ export type SchedulerFactory = (
|
|
|
) => Scheduler
|
|
|
|
|
|
export const createVaporSyncScheduler: SchedulerFactory =
|
|
|
- (instance) => (job, effect, isInit) => {
|
|
|
+ () => (job, effect, isInit) => {
|
|
|
if (isInit) {
|
|
|
effect.run()
|
|
|
} else {
|
|
|
@@ -241,7 +211,7 @@ export const createVaporRenderingScheduler: SchedulerFactory =
|
|
|
}
|
|
|
|
|
|
export const createVaporPostScheduler: SchedulerFactory =
|
|
|
- (instance) => (job, effect, isInit) => {
|
|
|
+ () => (job, effect, isInit) => {
|
|
|
if (isInit) {
|
|
|
queuePostRenderEffect(effect.run.bind(effect))
|
|
|
} else {
|