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

Allow bound method as event handler #4348

Merged

Conversation

benedikt-bartscher
Copy link
Contributor

No description provided.

@benedikt-bartscher benedikt-bartscher changed the title subtract 1 arg if the method is a bound method Allow bound method as event handler Nov 10, 2024
@benedikt-bartscher benedikt-bartscher marked this pull request as ready for review November 10, 2024 22:30
@adhami3310
Copy link
Member

We have this behavior already in the code? That's the number_of_bound_args argument.

@adhami3310
Copy link
Member

Also, in a case like this, tests would be appreciated to highlight if the existing code for this has regressed

@benedikt-bartscher
Copy link
Contributor Author

We have this behavior already in the code? That's the number_of_bound_args argument.

Yes, but it is not always set correctly. For some reason, it needs to be passed to check_fn_match_arg_spec.

Also, in a case like this, tests would be appreciated to highlight if the existing code for this has regressed

i will add one

@benedikt-bartscher
Copy link
Contributor Author

@adhami3310 I added a test which is similar to our regression. We are using smth like this for quite a while now and it works fine. However, this is not really a documented/supported feature of reflex. Hence, this PR could be seen as a feature, not a regression bug fix

@adhami3310
Copy link
Member

Since it's similar to the lambda feature, I think this one makes sense. Although it would have been cooler to unite it with that other path.

@adhami3310 adhami3310 merged commit e0984aa into reflex-dev:main Nov 21, 2024
32 checks passed
@benedikt-bartscher benedikt-bartscher deleted the fix-arg-calculation-for-methods branch November 21, 2024 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants