core / const

setCurrentEffect

Sets the currently executing effect.

Source: src/_core/signal/source-signal.ts

Sets the currently executing effect.

Called by the effect function before running the user's function to enable automatic dependency tracking. After the effect completes, this is set to null.

Signature

export const setCurrentEffect = (effect: SignalsEffect | null) =>
  (_currentSignalEffect = effect);

Parameters

  • effect: The effect to set as current, or null to clear tracking