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

improve event handler state references #2818

Merged

Conversation

benedikt-bartscher
Copy link
Contributor

@benedikt-bartscher benedikt-bartscher commented Mar 9, 2024

Fixes some issues with event handlers inherited from mixins across modules.
Should also fix potential issues with event handlers and States with the same name in the same module.
In general, this should be a much safer way to format event handlers.

@benedikt-bartscher benedikt-bartscher marked this pull request as ready for review March 9, 2024 11:46
@@ -147,6 +147,10 @@ class EventHandler(EventActionsMixin):
# The function to call in response to the event.
fn: Any

# The full name of the state class this event handler is attached to.
# Emtpy string means this event handler is a server side event.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Empty

# Get the state and the function name.
state_name, name = parts[-2:]
# Get the state full name
state_full_name = handler.state_full_name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nicer, good call

@picklelo picklelo merged commit 8a3c938 into reflex-dev:main Mar 11, 2024
45 checks passed
mahrz24 pushed a commit to mahrz24/reflex that referenced this pull request Mar 12, 2024
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.

3 participants