ref,
shallowRef,
toRaw,
+ triggerRef,
} from '../src'
import { EffectFlags, pauseTracking, resetTracking } from '../src/effect'
import type { ComputedRef, ComputedRefImpl } from '../src/computed'
await nextTick()
expect(serializeInner(root)).toBe(`<button>Step</button><p>Step 2</p>`)
})
+
+ it('manual trigger computed', () => {
+ const cValue = computed(() => 1)
+ triggerRef(cValue)
+ expect(cValue.value).toBe(1)
+ })
})
// and therefore tracks no deps, thus we cannot rely on the dirty check.
// Instead, computed always re-evaluate and relies on the globalVersion
// fast path above for caching.
- if (dep.version > 0 && !computed.isSSR && !isDirty(computed)) {
+ if (
+ dep.version > 0 &&
+ !computed.isSSR &&
+ computed.deps &&
+ !isDirty(computed)
+ ) {
computed.flags &= ~EffectFlags.RUNNING
return
}