Skip to content

Altair SolaraViz ignores dependencies / update_counter, causing stale renders #3243

@falloficarus22

Description

@falloficarus22

Description

SpaceRendererComponent accepts a dependencies parameter but only wires it into Matplotlib rendering. The Altair path does not use dependencies (or update_counter) at all, so updates that should trigger a redraw can be missed, leading to stale charts.

There’s a # FIXME: Manage dependencies properly comment at the SpaceRendererComponent signature, which appears to refer to this gap.

Steps to Reproduce

  1. Create a model that updates visible state each step.
  2. Use Altair backend in SolaraViz.
  3. Trigger updates via update_counter or by passing dependencies.
  4. Observe that the Altair chart does not re-render consistently.

Expected

Altair renders should respond to the same dependency signals as Matplotlib renders, including update_counter and any explicit dependencies passed into SpaceRendererComponent.

Actual

Altair rendering ignores dependencies, so updates may not trigger a re-render.

Proposed Fix

Compute viz_dependencies = [update_counter.value] + dependencies for both backends, and use these dependencies to drive Altair chart recomputation (e.g., via solara.use_memo or a supported dependencies argument to FigureAltair).

Possible Test

Add a test that renders SolaraViz with Altair, triggers a dependency change, and asserts that the draw methods are called again or that a new chart is produced.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions