vuejs / core-vapor

Vue Vapor is a variant of Vue that offers rendering without the Virtual DOM.
https://vapor-repl.netlify.app
MIT License
1.7k stars 81 forks source link

fix some lifecycle hooks apis #216

Open Ubugeeei opened 2 months ago

Ubugeeei commented 2 months ago

relates #215

There seem to be some points where the behavior differs from the original. I added FIXME comments in packages/runtime-vapor/tests/apiLifecycle.spec.ts.

LittleSound commented 2 months ago

This issue looks like it's related to PR #123 ?

I've created new BlockEffectScope and createChildFragmentDirectives functions that I hope will help make it easier to implement Lifecycle Hooks in Vapor. such as the lifecycle in slots or in components

LittleSound commented 1 month ago

If an update to a value is passed layer by layer from outside to inside, it will eventually only trigger the update hook of the component that actually uses the value. Such a design is obviously more efficient.

packages/runtime-vapor/tests/apiLifecycle.spec.ts | +319 to +327

// FIXME: not called
expect(calls).toEqual([
  // 'root beforeUpdate',
  // 'mid beforeUpdate',
  'child beforeUpdate',
  'child updated',
  // 'mid updated',
  // 'root updated',
])

But this design differs from core. How should we balance between the two?