Skip to content

@rx.memo with rx.RestProp doesn't handle CSS props correctly #6599

@masenf

Description

@masenf

Describe the bug
The rx.RestProp param does no additional processing of CSS props, so if any are passed through to a memo function, they end up as normal props, which are unrecognized on their target. There is no processing to distinguish them as style props.

To Reproduce

import reflex as rx


@rx._x.memo
def xmemo(rest: rx.RestProp) -> rx.Component:
    return rx.text("Foo", rest)


def index() -> rx.Component:
    return rx.container(
        rx.vstack(
            xmemo(font_weight="bold"),
            rx.text("Bar", font_weight="bold"),
        ),
    )


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

Expected behavior
Both "Foo" and "Bar" should be bold text, but the xmemo variant does not apply the boldness.

Specifics (please complete the following information):

  • Python Version: 3.10+
  • Reflex Version: 0.9.4+ (or rx._x.memo in 0.9+)
  • OS: any

Additional context
Workaround: pass the css props in a style dict

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
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