@amad3v/solid-echarts - v1.0.2
    Preparing search index...

    Function createAction

    • Reactive dispatchAction binding, fires whenever the action accessor returns a new payload. Conceptually identical to createEffect but purpose-built for actions: instead of running an arbitrary side effect, it calls chart.dispatchAction.

      Parameters

      • instance: Accessor<EChartsType | null>

        ECharts instance accessor, typically from createChart or useChart

      • action: Accessor<ActionPayload>

        Accessor returning the ActionPayload to dispatch. Re-evaluated whenever its reactive dependencies change.

      • Optionalopt: DispatchOpt

        Optional dispatch options passed to every dispatchAction call.

      Returns void

      Unlike dispatch which is imperative ("fire this action now"), createAction is declarative - "keep this action in sync with this state".

      Built-in guards make it safe to call at any time:

      • Before the instance is ready - silently waits
      • After the instance is disposed - silently no-ops
      • After a renderer reinit - re-fires automatically on the new instance because both instance and action are tracked dependencies

      The first run is deferred intentionally, dispatching before the chart has rendered its first frame causes actions like highlight and showTip to silently no-op since the model isn't ready yet.

      // Highlight follows a hovered table row - both states in one accessor
      const [hoveredRow, setHoveredRow] = createSignal<number | null>(null);

      createAction(instance, () =>
      hoveredRow() !== null
      ? seActions.highlight({ seriesIndex: 0, dataIndex: hoveredRow()! })
      : seActions.downplay({})
      );

      // ...
      // Table rows update the signal - chart reacts automatically
      <tr onMouseEnter={() => setHoveredRow(i)} onMouseLeave={() => setHoveredRow(null)}>
      • useChart for the imperative dispatch alternative
      • seActions for typed action payload factories