Skip to content

Function: prepareChart()

prepareChart(opts): Promise<{ chartId: string; marker: string; }>

Mint a chartId, cache an empty { chartId } placeholder synchronously, and kick off a background task that resolves the dataset and runs the planner. Returns the chartId once the placeholder lands so the first fetchChart call always sees an entry (no spurious 404 race).

The background task swallows its own failures and writes them as error entries, so callers never see a rejected promise. Cache state machine:

  • just after this call returns: { chartId } (processing)
  • on planner success: { chartId, result }
  • on data / planner failure: { chartId, error }

PrepareChartOptions

Promise<{ chartId: string; marker: string; }>