Skip to content

Commit

Permalink
Implement scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk authored and sxzz committed Sep 28, 2024
1 parent 00a49ea commit 0ab06d6
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions packages/runtime-vapor/src/renderEffect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ import {
} from './scheduler'
import { VaporErrorCodes, callWithAsyncErrorHandling } from './errorHandling'
import { memoStack } from './memo'
import {
ReactiveEffect,
effect as effect2,
getCurrentScope,
} from '@johnsoncodehk/signals/vue'
import { ReactiveEffect, getCurrentScope } from '@johnsoncodehk/signals/vue'

export function renderEffect(cb: () => void): void {
const instance = getCurrentInstance()
Expand Down Expand Up @@ -44,11 +40,15 @@ export function renderEffect(cb: () => void): void {
memoCaches = memos.map(memo => memo())
}

const effect = effect2(() =>
callWithAsyncErrorHandling(cb, instance, VaporErrorCodes.RENDER_FUNCTION),
)
const effect = new ReactiveEffect(() => {
return callWithAsyncErrorHandling(
cb,
instance,
VaporErrorCodes.RENDER_FUNCTION,
)
})

// effect.scheduler = () => queueJob(job)
effect.scheduler = () => queueJob(job)
// if (__DEV__ && instance) {
// effect.onTrack = instance.rtc
// ? e => invokeArrayFns(instance.rtc!, e)
Expand All @@ -57,12 +57,12 @@ export function renderEffect(cb: () => void): void {
// ? e => invokeArrayFns(instance.rtg!, e)
// : void 0
// }
// effect.run()
effect.run()

function job() {
// if (!(effect.flags & EffectFlags.ACTIVE) || !effect.dirty) {
// return
// }
if (!effect.dirty) {
return
}

if (memos) {
let dirty: boolean | undefined
Expand Down

0 comments on commit 0ab06d6

Please sign in to comment.