vapor-chamber API reference - v1.16.0
    Preparing search index...

    Function untracked

    • untracked — run fn without its reactive reads becoming dependencies of whatever effect is currently running.

      A dispatch is an ACTION, not a read: nothing it touches should make the caller re-run. Every composable in this module already applies this to its own dispatches, so you only need it when calling a raw bus from inside a reactive effect:

      Type Parameters

      • T

      Parameters

      • fn: () => T

      Returns T

      import { untracked, getCommandBus } from 'vapor-chamber';
      watchEffect(() => {
      // without untracked(), anything the HANDLER reads becomes a dependency
      // of this effect, and it re-runs on state it never mentions
      untracked(() => getCommandBus().dispatch('cartSync', cart));
      });

      No-op when Vue is not present, so it is safe to leave in shared code.
      Vue fixed the same class of bug twice in 3.6.0-rc.3 (#15203, #15204) by
      suspending tracking around callbacksthis is that idea at the bus edge.