Skip to content

move on submit form spec to event.py#5638

Merged
adhami3310 merged 1 commit into
mainfrom
move-on-submit-form-spec-to-event.py
Jul 30, 2025
Merged

move on submit form spec to event.py#5638
adhami3310 merged 1 commit into
mainfrom
move-on-submit-form-spec-to-event.py

Conversation

@adhami3310
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR refactors form submission event specifications by moving them from reflex/components/el/elements/forms.py to the central reflex/event.py module. Specifically, it relocates:

  • The FORM_DATA constant (a JavaScript expression variable)
  • The on_submit_event() function that returns form data as a dictionary
  • The on_submit_string_event() function that returns form data with string values

These functions were previously defined locally within the forms component file but are now centralized in the event module where all event specifications belong. The moved functions are then imported back into forms.py and added to the EventNamespace class as static methods to maintain API compatibility.

This change improves code organization by consolidating event-related functionality in a single location while maintaining backward compatibility. The Form component continues to use the same event handler types for its on_submit property, but now references the centralized definitions. The refactoring follows the single responsibility principle by placing event specifications in their logical home rather than scattering them across component files.

Confidence score: 5/5

  • This is a safe refactoring that moves code without changing functionality
  • Proper imports maintain backward compatibility and all references are updated correctly
  • The change improves code organization by centralizing event specifications in their appropriate module
  • No files need additional attention as the changes are straightforward and well-contained

3 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jul 29, 2025

CodSpeed Performance Report

Merging #5638 will not alter performance

Comparing move-on-submit-form-spec-to-event.py (2112925) with main (1aafe9a)

Summary

✅ 8 untouched benchmarks

@adhami3310 adhami3310 merged commit 115c6dd into main Jul 30, 2025
41 checks passed
@adhami3310 adhami3310 deleted the move-on-submit-form-spec-to-event.py branch July 30, 2025 21:14
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