Skip to content

Commit

Permalink
Merge pull request #194 from Expensify/marcaaron-fixLoops
Browse files Browse the repository at this point in the history
Revert for loop reverse iteration
  • Loading branch information
stitesExpensify authored Oct 6, 2022
2 parents 7b05124 + f86d344 commit 314beac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Onyx.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ function keysChanged(collectionKey, partialCollection) {
// individual collection key member for the collection that is being updated. It is important to note that the collection parameter cane be a PARTIAL collection
// and does not represent all of the combined keys and values for a collection key. It is just the "new" data that was merged in via mergeCollection().
const stateMappingKeys = _.keys(callbackToStateMapping);
for (let i = stateMappingKeys.length; i--;) {
for (let i = 0; i < stateMappingKeys.length; i++) {
const subscriber = callbackToStateMapping[stateMappingKeys[i]];
if (!subscriber) {
continue;
Expand Down Expand Up @@ -383,7 +383,7 @@ function keyChanged(key, data) {
// notify them if the key that changed is a collection member. Or if it is a regular key notify them when there is an exact match. Depending on whether the subscriber
// was connected via withOnyx we will call setState() directly on the withOnyx instance. If it is a regular connection we will pass the data to the provided callback.
const stateMappingKeys = _.keys(callbackToStateMapping);
for (let i = stateMappingKeys.length; i--;) {
for (let i = 0; i < stateMappingKeys.length; i++) {
const subscriber = callbackToStateMapping[stateMappingKeys[i]];
if (!subscriber || !isKeyMatch(subscriber.key, key)) {
continue;
Expand Down

0 comments on commit 314beac

Please sign in to comment.