Skip to main content

recompute

Function recompute 

Source
pub fn recompute(render_state: &ArcSwap<RenderState>) -> WorkerDecision
Expand description

Pure synchronous recompute. Reads the current published CellsRenderState, iterates over every visible Document pane (cells.panes), and updates each pane’s matrix independently. Returns the aggregate decision used to gate the renderer paint_request wake:

  • Clear: at least one pane saw a Clear (and no pane saw a content-producing rebuild).
  • Recomputed / RecomputedIncremental: at least one pane rebuilt content. Recomputed wins when both kinds of rebuild fire in one tick, since the renderer just needs to know “something changed” — the exact mix matters per-pane only.
  • CacheHit: every pane was idle (or panes was empty). No paint wake.

D.4.d.1.b (2026-05-29): pre-d.1.b, the worker wrote into a single top-level matrix_cell corresponding to the active document. Now each pane’s own Arc<ArcSwap<CellMatrix>> is the write target — the renderer reads them per pane in D.4.d.1.c.