There was a bug, where after typing the character the cursor was moved to the end of the text area. It made editing the middle of the content very cumbersome. This address this issue, now focusAndUpdateText() method is called only once, not after every text change.
Details
Details
- Entered edit mode on the web
- Checked if the textarea is focused
- Edited the message in the middle, checked if the cursor is not moved to the end
Diff Detail
Diff Detail
- Repository
- rCOMM Comm
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
web/chat/chat-input-text-area.react.js | ||
---|---|---|
69 ↗ | (On Diff #27292) | Would it be bad to add updateHeight to the dep list here? |
web/chat/chat-input-text-area.react.js | ||
---|---|---|
69 ↗ | (On Diff #27292) | This results in this warning thrown all the time: Warning: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render. |
web/chat/chat-input-text-area.react.js | ||
---|---|---|
69 ↗ | (On Diff #27292) | Can you investigate why adding updateHeight to the dep list causes a stack overflow? In particular, I'd like to understand why onChangePosition is getting changed when the height changes |
web/chat/chat-input-text-area.react.js | ||
---|---|---|
69 ↗ | (On Diff #27292) | I believe that this is why it causes a stack overflow:
|
web/chat/chat-input-text-area.react.js | ||
---|---|---|
69 ↗ | (On Diff #27292) | Makes sense! Can you add this code comment for clarity? (Make sure lines are <=80 chars each) // We want to update the height when the text changes. We can't include // updateHeight in the dep list because it causes a stack overflow... see // comments on D8035 for more details |