fix: Post button still disabled after pasting text#2942
Conversation
…er the paste command has been processed
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adjusts the form controller’s submit-disabling behavior by adding an additional frame delay before checking form validity.
Changes:
- Adds a second
await nextFrame()before runningcheckValidity()indisableSubmitWhenInvalid.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| async disableSubmitWhenInvalid(event) { | ||
| await nextFrame() | ||
| await nextFrame() |
There was a problem hiding this comment.
The git message attached to this line is sufficient explaination of why it was needed, no need to bloat the code base with a comment.
Also dont like the nextFame(2) proposal. I'd rather update the nextFrame implementation be a double raf by default, because the requestAnimationFrame fires before the frame, so the next frame should use a double raf, but that would change the behavior in the other 10 spots where the nextFrame() is used, so adding a second one here was a safer change.
The checkValidity() is always one step behind ( this might be an issue with lexxy that fires the change event too soon )
The issue
This is not much of an issue when typing a comment, as that is generally more than 1 character.

But when pasting content is an issue, as demonstated here:
Fix
The fix was to wait two frames, instead of one, so the checkValidity() is based on contents after the command has been processed.