Skip to content

reflex-xy static charts crash when core Figure lacks dom_class_strings #81

Description

@amsraman

Summary

reflex_xy.chart(chart_object) crashes during Reflex page compilation when the installed xy core Figure does not expose dom_class_strings(), while the reflex-xy adapter calls it unconditionally.

This prevents using the documented static-payload fallback when live state-backed charts are unavailable or undesirable.

Reproduction

import reflex as rx
import reflex_xy
import xy

chart = xy.scatter_chart(
    xy.scatter([1, 2, 3], [3, 2, 1]),
    width="100%",
    height=400,
)

def index():
    return reflex_xy.chart(chart, height="400px")

app = rx.App()
app.add_page(index)

Run:

reflex export --no-zip

Observed

AttributeError: 'Figure' object has no attribute 'dom_class_strings'

  File "reflex_xy/component.py", line 138, in chart
    class_manifest = _tailwind_class_manifest(figure)
  File "reflex_xy/component.py", line 109, in _tailwind_class_manifest
    return " ".join(figure.dom_class_strings())

Expected

The adapter should either:

  • declare/enforce a compatible minimum xy version;
  • feature-detect dom_class_strings() and treat a missing method as an empty optional class manifest; or
  • provide a clear version-compatibility error before page compilation.

A static chart with no Tailwind class inventory should still compile and render.

Context

This appeared while switching a Reflex dashboard from state-backed chart tokens to documented direct Chart sources. The page shell rendered, but live charts were blank due to a separate frontend/backend version mismatch. Static payload mode was the intended resilient fallback, but compilation then failed on this missing method.

Environment

  • reflex-xy 0.1.0 (editable repository package)
  • installed xy core exposing Figure without dom_class_strings()
  • Reflex 0.9.7
  • macOS Apple Silicon

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions