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

Fix 'enter_key_submit=True' on 'rx.text_area' by carrying custom_code on debounce #4142

Merged
merged 2 commits into from
Oct 24, 2024

Conversation

masenf
Copy link
Collaborator

@masenf masenf commented Oct 9, 2024

Alternative to #4084

  • Allow debounce to carry any custom code defined in the child component
  • Move special behavior handling to create classmethod to allow carrying of added props when wrapped in debounce (which does not call _render on the child component).

I think this is preferable to the original patch, because it still allows the debounce to work, avoiding typing jank, and it also works with auto_height behavior.

Fix #4080

Include _get_all_hooks when rendering the child element, instead of just
internal hooks.
Move special behavior handling to `create` classmethod to allow carrying of
added props when wrapped in debounce, which does not call `_render` on the
child component.
@TimChild
Copy link
Contributor

TimChild commented Oct 9, 2024

@masenf, Works great in the test cases I was using for text areas!
Also, definitely better to take this approach. I was doing more testing this morning and realising how janky things get once it's not running locally!

On a related note. How hard would it be to make the DebounceInput work for the rx.slider as well?
For the slider, rx.set_value doesn't work, so I think there is currently no way to be able to use and set slider values without having a slow value/on_change combo.

@masenf
Copy link
Collaborator Author

masenf commented Oct 10, 2024

How hard would it be to make the DebounceInput work for the rx.slider as well?
For the slider, rx.set_value doesn't work, so I think there is currently no way to be able to use and set slider values without having a slow value/on_change combo.

@TimChild Can you make a new github discussion forum post for this question and i'll answer it over there with a code example

@TimChild
Copy link
Contributor

@masenf I only see an option to create a new Poll when trying to create a new discussion. Should I be able to see something else? Or did you mean to create an issue?

@masenf
Copy link
Collaborator Author

masenf commented Oct 10, 2024

@TimChild sorry i forgot, we're moving long form support like that over to our new forum

https://forum.reflex.dev/

This will help people searching on google find the answers 😁

@TimChild
Copy link
Contributor

@masenf masenf merged commit 2e703f7 into main Oct 24, 2024
31 checks passed
@masenf masenf deleted the masenf/debounce-custom-code branch October 24, 2024 21:34
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.

enter_key_submit doesn't work for rx.text_area if value is set (works for rx.el.textarea).
3 participants