Fork me on GitHub
#reagent
<
2023-06-09
>
Ernesto Garcia14:06:46

Let's say that you implement an input element's onChange for updating a Reagent atom that triggers a change for displaying the count of characters entered somewhere on your UI. The undo behavior of the input element is altered, in a way that it undoes one character at a time, instead of the default behavior of undoing chunks of characters that were entered together. This is probably due to the delayed nature of Reagent UI updates. Has anybody seen this? Can this be avoided?

👀 2
juhoteperi14:06:06

You should be able to go around Reagents workaround by creating a input element directly with React call: (react/createElement "input" #js {...} ...) (but then you need to handle other problems yourself.)

Ernesto Garcia14:06:18

The issue is not because of the ReagentInput wrapper. It will also happen with a standard React input.

Ernesto Garcia14:06:24

It happens also when the input is not controlled.

2
Ernesto Garcia14:06:26

It seems to be the delayed UI update that makes the browser delimit the action to undo.

Ernesto Garcia07:06:11

Sorry guys, I'm not seeing the same behavior today. I'm not sure when the problem manifests.

Ernesto Garcia10:06:22

It may only happen when the input is controlled.