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

All event handlers inherit from event triggers #2507

Merged
merged 12 commits into from Feb 2, 2024

Conversation

tgberkeley
Copy link
Collaborator

All Submissions:

  • Have you followed the guidelines stated in CONTRIBUTING.md file?
  • Have you checked to ensure there aren't any other open Pull Requests for the desired changed?

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

New Feature Submission:

  • Does your submission pass the tests?
  • Have you linted your code locally prior to submission?

Changes To Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

After these steps, you're ready to open a pull request.

a. Give a descriptive title to your PR.

b. Describe your changes.

c. Put `closes #XXXX` in your comment to auto-close the issue that your PR fixes (if such).

reflex/components/component.py Outdated Show resolved Hide resolved
Comment on lines 76 to 82
def render(self) -> dict:
"""Render the component."""
render_dict = super().render()
print(render_dict)
self._replace_prop_names(render_dict)
print(render_dict)
return render_dict
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think this logic should go in Component.render itself. since the _rename_props attribute is defined on Component, it wouldn't really make sense to be able to set _rename_props, but then not have it work until the downstream component overrides render.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added

Returns:
None
"""
for ix, prop in enumerate(render_dict["props"]):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
for ix, prop in enumerate(render_dict["props"]):
# fast path
if not self._rename_props:
return
for ix, prop in enumerate(render_dict["props"]):

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changed

@@ -648,8 +651,25 @@ def render(self) -> Dict:
),
autofocus=self.autofocus,
)
self._replace_prop_names(rendered_dict)
self._replace_prop_names(rendered_dict)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why twice?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed this

Copy link
Collaborator

@masenf masenf left a comment

Choose a reason for hiding this comment

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

approve, when CI passes

@masenf masenf merged commit 1b42296 into main Feb 2, 2024
45 checks passed
@masenf masenf deleted the all-event-handlers-inherit-from-EventTriggers branch February 2, 2024 00:11
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.

None yet

2 participants