Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EventFnArgMismatch is raised on event_chain #4003

Closed
LeoGrosjean opened this issue Sep 25, 2024 · 1 comment
Closed

EventFnArgMismatch is raised on event_chain #4003

LeoGrosjean opened this issue Sep 25, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@LeoGrosjean
Copy link
Contributor

Describe the bug
In event.call_event_fn release 0.6.0

...
# Check that fn signature matches arg_spec
fn_args = inspect.getfullargspec(fn).args
n_fn_args = len(fn_args)
if isinstance(fn, types.MethodType):
    n_fn_args -= 1  # subtract 1 for bound self arg
parsed_args = parse_args_spec(arg_spec)
if len(parsed_args) != n_fn_args:
    raise EventFnArgMismatch(
        "The number of arguments accepted by "
        f"{fn} ({n_fn_args}) "
        ...
        f"{[str(v) for v in parsed_args]}\n"
        "See https://reflex.dev/docs/events/event-arguments/"
    )
...

This code will raise EventFnArgMismatch when we pass an object of type EventSpec because it don't check default argument !

To Reproduce
Steps to reproduce the behavior:

rx.select.root(
    rx.select.trigger("Pick a techno !"),
    rx.select.content(
        rx.select.group(
            rx.select.item(
                "Home", value="/"
            ),
            rx.select.item(
                "Home2", value="not empty"
            ),
        ),
    ),
    value=State.router.page.path,
    on_change=rx.redirect,
)

Expected behavior
Not raising the exception EventFnArgMismatch !

Specifics (please complete the following information):

  • Python Version: 3.9, 3.10
  • Reflex Version: 0.6.0
  • OS: windows

Additional context
Add any other context about the problem here.

@LeoGrosjean LeoGrosjean added the bug Something isn't working label Sep 25, 2024
@masenf
Copy link
Collaborator

masenf commented Oct 1, 2024

Fixed in 0.6.1

@masenf masenf closed this as completed Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants