Skip to content

Event types are not checked fully when some arguments are bound and some arguments are not #5262

@adhami3310

Description

@adhami3310

Event types are not checked when some arguments are bound and some are not. In the cases of arguments with defaults it's even more confusing.

"""App for testing."""

import reflex as rx


class State(rx.State):
    @rx.event
    def on_submit(self, arg1: int, arg2: str = "default"):
        """Handle the submit event."""
        print(f"Submit called with {arg1} and {arg2}")


def index():
    return rx.form(rx.button("Submit"), on_submit=State.on_submit(1))


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

Here it prints a dict for arg2, instead of "default".

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions