workflow-kotlin icon indicating copy to clipboard operation
workflow-kotlin copied to clipboard

TextChangedListenerWatcher sometimes doesn't notify of changes

Open NickvanDyke opened this issue 4 years ago • 1 comments
trafficstars

TextChangedListenerWatcher tracks the most recent text (oldString), so that it doesn't notify the listener if the text is "updated" to the same thing. However, since updateText does not notify this watcher of text changes, oldString is not updated. Changes from updateText are essentially ignored when considering whether a text update is a duplicate and therefore whether to fire the listener.

e.g. in a chat portion of my app:

  1. Type "t" (or any letter) in the message box
  2. Press send; this updates the workflow's state's representation of the input to an empty string after sending it, which is then used in updateText by the LayoutRunner, setting the EditText's content to empty
  3. Because of the bug, oldString was not updated to "" by updateText and is still "t". So if the user types "t" again, TextChangedListenerWatcher thinks it's a duplicate and doesn't fire the listener. The EditText's content changes to "t", but the workflow is not notified of the change, and it's state's field representing the input remains ""

NickvanDyke avatar Apr 26 '21 14:04 NickvanDyke

Fixed with the introdcution of TextController, but we should delete the deprecated class. Leaving this ticket open to track that.

rjrjr avatar Apr 15 '22 21:04 rjrjr