-
Description |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
So I found the solution: My code was: @component
def Input(
set_value: Callable,
value: Any,
label: str = "",
type: str = "text",
placeholder: str = "Write here the",
):
return html.input(
{
"type": type,
"placeholder": f"{placeholder} {label}",
"value": value
"onChange": lambda event: set_value(event["target"]["value"]),
}
) I was passing state value as the |
Beta Was this translation helpful? Give feedback.
-
Ok, looking into this, there may not be a great way to resolve the underlying issue. What's happening is that, because there's a delay between a key being typed and the character showing up in the input, it's possible to press another key before the first one has been rendered to the screen. Let's say we want to type "world" and we do so at a rate which is double that of the render rate (that is we type two keys in the time we render once). When we look at the
This happens because by the time we type |
Beta Was this translation helpful? Give feedback.
Ok, looking into this, there may not be a great way to resolve the underlying issue. What's happening is that, because there's a delay between a key being typed and the character showing up in the input, it's possible to press another key before the first one has been rendered to the screen. Let's say we want to type "world" and we do so at a rate which is double that of the render rate (that is we type two keys in the time we render once). When we look at the
event.target.value
for eachonChange
event we'd see the following:"w"
"o"
"or"
"ol"
"old"
This happens because by the time we type
"o"
, the"w"
hasn't appear in the input yet. Thus the change from""
to the most recently typed"o"
…