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

Revert "Use DebounceInput wrapper for fully controlled Editable" #1670

Merged
merged 2 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions reflex/components/forms/editable.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

from typing import Dict

from reflex.components.component import Component
from reflex.components.forms.debounce import DebounceInput
from reflex.components.libs.chakra import ChakraComponent
from reflex.event import EVENT_ARG
from reflex.vars import Var
Expand Down Expand Up @@ -38,29 +36,6 @@ class Editable(ChakraComponent):
# The initial value of the Editable in both edit and preview mode.
default_value: Var[str]

@classmethod
def create(cls, *children, **props) -> Component:
"""Create an Editable component.

Args:
children: The children of the component.
props: The properties of the component.

Returns:
The component.
"""
if (
isinstance(props.get("value"), Var) and props.get("on_change")
) or "debounce_timeout" in props:
# Create a debounced input if the user requests full control to avoid typing jank
# Currently default to 50ms, which appears to be a good balance
debounce_timeout = props.pop("debounce_timeout", 50)
return DebounceInput.create(
super().create(*children, **props),
debounce_timeout=debounce_timeout,
)
return super().create(*children, **props)

def get_controlled_triggers(self) -> Dict[str, Var]:
"""Get the event triggers that pass the component's value to the handler.

Expand Down
48 changes: 0 additions & 48 deletions tests/components/forms/test_editable.py

This file was deleted.