Skip to content

v0.8.0 - Dispatch

Choose a tag to compare

@kvvasuu kvvasuu released this 10 Sep 19:11
· 312 commits to main since this release

v0.8.0 - Dispatch

⚠️ Breaking Changes

  • react peer bumped to >=19.2.0 (from ^19.0) - the event system below uses useEffectEvent, stable only from React 19.2 onward. Only affects the @kvvasuu/klipp/react entry point; the framework-agnostic @kvvasuu/klipp engine has no React dependency at all, so this doesn't touch it.

✨ New Features

  • Camera Events - KlippCore now extends three's EventDispatcher, dispatching activated/deactivated/blendCreated/blendFinished/cut for every arbitration and blend transition it drives. VirtualCameraController extends EventDispatcher too, re-dispatching only the events one specific camera takes part in - activated when it's incoming, deactivated when it's outgoing, blendCreated/cut on either side, blendFinished when it's the one that just settled live. Two ways to listen to either: <Klipp.Events>/<VirtualCamera.Events> as callback props, or a ref on <VirtualCamera> for addEventListener straight on the underlying VirtualCameraController.

🐛 Bug Fixes

  • CameraControls no longer reconnects on every unrelated re-render - its on* event props (onControlStart/onUpdate/etc.) used to sit in the connect effect's dependency array, so a fresh inline callback from any parent re-render tore down and rebuilt the whole camera-controls connection, occasionally dropping an in-progress drag. Now handled via useEffectEvent, so only an actual change in target/domElement/arbitration reconnects.

🔧 Internal Changes

  • Hardened KlippCore.tick()'s event dispatch against reentrancy - a listener that synchronously calls registerCamera/updatePriority can no longer corrupt a later event's payload within the same tick.
  • New tests: KlippCore, VirtualCameraController, VirtualCamera, and CameraControls all get coverage for the new events and the two fixes above.
  • Docs: a new Events page under Advanced, covering both listening paths, all five events, and the ref alternative.

What's Changed

Full Changelog: v0.7.0...v0.8.0