Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1575 from matrix-org/luke/fix-flair-store-again
Browse files Browse the repository at this point in the history
Fix Flair not appearing due to missing this._usersInFlight
  • Loading branch information
ara4n committed Nov 3, 2017
2 parents d03f282 + da23afd commit d4adff3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/stores/FlairStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ class FlairStore extends EventEmitter {
// reject: () => {}
// }
};
this._usersInFlight = {
// This has the same schema as _usersPending
};

this._debounceTimeoutID = null;
}
Expand Down Expand Up @@ -125,12 +128,16 @@ class FlairStore extends EventEmitter {
} catch (err) {
// Propagate the same error to all usersInFlight
Object.keys(this._usersInFlight).forEach((userId) => {
// The promise should always exist for userId, but do a null-check anyway
if (!this._usersInFlight[userId]) return;
this._usersInFlight[userId].reject(err);
});
return;
}
const updatedUserGroups = resp.users;
Object.keys(this._usersInFlight).forEach((userId) => {
// The promise should always exist for userId, but do a null-check anyway
if (!this._usersInFlight[userId]) return;
this._usersInFlight[userId].resolve(updatedUserGroups[userId] || []);
});
}
Expand Down

0 comments on commit d4adff3

Please sign in to comment.