-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only debounce saving draft when user is typing #11552
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks OK, but I've got this nagging feeling that I don't know that componentDidUpdate()
should be calling updateComment()
directly. It feels like there is a lot of logic in updateComment()
that is unnecessary in that context, but maybe I am wrong. Same thing goes for componentDidMount()
and all the other methods calling updateComment()
. It's like updateComment()
is just a catch-all for a bunch of different things, and I think race conditions like this are a good indication that this is a bad pattern.
Can you please add videos from the different platforms to the description? |
|
BUG - WEB: While doing test 1, I can still reproduce the problem.
Actually happening: Draft message disappears, but then reappears after a couple of seconds Expected to happen: Draft message disappear forever BUG: - WEB: While doing test 2, when I refresh the page, the draft message is no longer in the composer, it is blank, so the test cannot be performed.
Actually happening: Draft message disappears Expected to happen: Draft message is still there |
Good catch, I just pushed a fix for this. Basically when you type something and then quickly press enter, a few ms later the debounced
Sorry should have been more clear, but you need to wait a second or two for Onyx state to be saved before refreshing. If you refresh right away the state won't be saved as it's debounced. Adding recordings shortly. Let me know if the last commit fixes the issues! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me and test well on desktop, web, & mobile web. I'm assuming this can't be tested in native mobile since the testing steps require a refresh?
Good catch. For mobile native we can close/reopen the app to simulate the same scenario. Will update the tests in the issue. |
Confirmed tests pass on both native mobile platforms 👍 |
@tgolen I totally agree. I think we may need to rethink how we're using |
OK, I've completed testing and the checklist, so I will merge this. |
@tgolen looks like this was merged without passing tests. Please add a note explaining why this was done and remove the |
Tests passed Melvin. |
What's status on this? I see the |
It should be... but it looks like it wasn't CPed for some reason. @AndrewGable are you seeing issues with the CP staging at all this week? |
🚀 Deployed to production by @AndrewGable in version: 1.2.12-4 🚀
|
…_reappearing Only debounce saving draft when user is typing
Details
We were debouncing the call to
Report.saveReportComment
even when the change in comment is not coming from the user typing. This caused a race condition between these two calls:componentDidUpdate
calls debouncedReport.saveReportComment
(throughupdateComment
) with previous Onyx state which contains the draft.submitForm
calls debouncedReport.saveReportComment
(throughupdateComment
) with new empty comment to clear the composer.Fixed Issues
$ #11526
Tests
Test 1
Test 2
PR Review Checklist
Contributor (PR Author) Checklist
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
displayName
propertythis
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)PR Reviewer Checklist
The Contributor+ will copy/paste it into a new comment and complete it after the author checklist is completed
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
).src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
have been tested & I retested again)/** comment above it */
displayName
propertythis
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)QA Steps
Test 1
Test 2
Screenshots
Web
SR.-.Web.mov
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android