fix(ui): Fix crash when viewing an invalid certificate (#43681)

* fix: remove empty object literal creation causing #43224

* fix: initialize userByName selector using empty object from initialState to keep the same reference instead

* fix(lang): added translation for invalid certificate
This commit is contained in:
Lim Shang Yi
2021-10-07 03:05:05 +08:00
committed by GitHub
parent 7824f13f5f
commit df8dc9b9c6
4 changed files with 13 additions and 4 deletions

View File

@@ -229,8 +229,9 @@ export const shouldRequestDonationSelector = state => {
export const userByNameSelector = username => state => {
const { user } = state[ns];
// TODO: Why return a string or empty objet literal?
return username in user ? user[username] : {};
// return initial state empty user empty object instead of empty
// object litteral to prevent components from re-rendering unnecessarily
return user[username] ?? initialState.user;
};
export const certificatesByNameSelector = username => state => {