-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Fix replay effect #16545
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
Merged
Merged
Fix replay effect #16545
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c53fa0e
Store pusherSocketID to send with requests
neil-marcellini 4bc9d6f
Lint, export getPusherSocketID vs mutable export
neil-marcellini 9731a17
Send socket id in requests to fix replay effect
neil-marcellini 237abd1
Create actions to queue onyx updates
neil-marcellini 3e6f2a4
pusherSocketID is only needed in write requests
neil-marcellini 38a5653
Queue then update Onyx after SequentialQueue flush
neil-marcellini 7c0433e
Merge branch 'main' into neil-replay-effect
neil-marcellini b057930
socket_id is only available once connected
neil-marcellini c6d10bd
Properly check apiRequestType
neil-marcellini 3c7e9f9
Handle all updates before clearing queued updates
neil-marcellini eb74861
Add file description comment per checklist
neil-marcellini 2fabf6e
Small cleanup from review feedback
neil-marcellini abc6a08
Merge branch 'main' into neil-replay-effect
neil-marcellini 6a42b9a
Process and update Onyx only if requests exist
neil-marcellini File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import Onyx from 'react-native-onyx'; | ||
| import ONYXKEYS from '../../ONYXKEYS'; | ||
|
|
||
| // In this file we manage a queue of Onyx updates while the SequentialQueue is processing. There are functions to get the updates and clear the queue after saving the updates in Onyx. | ||
|
|
||
| let queuedOnyxUpdates = []; | ||
| Onyx.connect({ | ||
| key: ONYXKEYS.QUEUED_ONYX_UPDATES, | ||
| callback: val => queuedOnyxUpdates = val || [], | ||
| }); | ||
|
|
||
| /** | ||
| * @param {Array<Object>} updates Onyx updates to queue for later | ||
| * @returns {Promise} | ||
| */ | ||
| function queueOnyxUpdates(updates) { | ||
| return Onyx.merge(ONYXKEYS.QUEUED_ONYX_UPDATES, updates); | ||
| } | ||
|
|
||
| function clear() { | ||
| Onyx.set(ONYXKEYS.QUEUED_ONYX_UPDATES, null); | ||
| } | ||
|
|
||
| /** | ||
| * @returns {Array<Object>} | ||
| */ | ||
| function getQueuedUpdates() { | ||
| return queuedOnyxUpdates; | ||
| } | ||
|
|
||
| export { | ||
| queueOnyxUpdates, | ||
| clear, | ||
| getQueuedUpdates, | ||
| }; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
fwiw it is easy for people to find linked issues by using git blame. usually there is no need to add a link to a github issue.