Skip to content

DataEditor does not apply the default string type to reactive columns #7596

Closed

Description

@harsh21234i

Describe the bug

The documented default column type of "str" is applied to literal columns, but not to state-backed (reactive) columns. A reactive column without an explicit type produces an invalid Glide TextCell and crashes when the grid renders it.

To reproduce

import reflex as rx

class GridState(rx.State):
    columns: list[dict[str, str]] = [{"title": "Name"}]
    data: list[list[str]] = [["Alice"]]

def index() -> rx.Component:
    return rx.data_editor(columns=GridState.columns, data=GridState.data)

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

The Data Editor docs state that type defaults to "str". With a literal list, DataEditor.create applies that default via format_data_editor_column. When columns is a Var (as above), that normalization is skipped. The frontend fallback then returns a Text cell with data: "Alice" but displayData: undefined.

I executed the current formatCell helper with this input and confirmed that output. The component is pinned to Glide Data Grid 6.0.3; its TextCell renderer passes displayData to drawTextCell, which calls string methods on it. Thus the missing default can throw during cell rendering, rather than merely omit the text.

Expected behavior

A reactive column without an explicit type should behave like a literal column: default to "str" and render the cell value.

References

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