We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 64e719e + 9489b25 commit ff54c9eCopy full SHA for ff54c9e
src/libs/actions/PersistedRequests.js
@@ -25,7 +25,15 @@ function save(requestsToPersist) {
25
* @param {Object} requestToRemove
26
*/
27
function remove(requestToRemove) {
28
- persistedRequests = _.reject(persistedRequests, (persistedRequest) => _.isEqual(persistedRequest, requestToRemove));
+ /**
29
+ * We only remove the first matching request because the order of requests matters.
30
+ * If we were to remove all matching requests, we can end up with a final state that is different than what the user intended.
31
+ */
32
+ const index = _.findIndex(persistedRequests, (persistedRequest) => _.isEqual(persistedRequest, requestToRemove));
33
+ if (index !== -1) {
34
+ persistedRequests.splice(index, 1);
35
+ }
36
+
37
Onyx.set(ONYXKEYS.PERSISTED_REQUESTS, persistedRequests);
38
}
39
0 commit comments