You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-28 15:22:05 +03:00
Only mark group as failed to load for summary
Currently, any error in the `GroupStore`s several requests can cause the whole `GroupView` component to hide and be mark the group as failed to load. Since it is known that group members may fail to load in some cases, let's only show failed to load for the whole group when the summary fails. This also strengthens the `GroupView` test by ensuring we wait for multiple updates for checking results. Signed-off-by: J. Ryan Stinnett <jryans@gmail.com>
This commit is contained in:
@ -310,19 +310,26 @@ export function wrapInMatrixClientContext(WrappedComponent) {
|
||||
/**
|
||||
* Call fn before calling componentDidUpdate on a react component instance, inst.
|
||||
* @param {React.Component} inst an instance of a React component.
|
||||
* @param {integer} updates Number of updates to wait for. (Defaults to 1.)
|
||||
* @returns {Promise} promise that resolves when componentDidUpdate is called on
|
||||
* given component instance.
|
||||
*/
|
||||
export function waitForUpdate(inst) {
|
||||
export function waitForUpdate(inst, updates = 1) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const cdu = inst.componentDidUpdate;
|
||||
|
||||
console.log(`Waiting for ${updates} update(s)`);
|
||||
|
||||
inst.componentDidUpdate = (prevProps, prevState, snapshot) => {
|
||||
resolve();
|
||||
updates--;
|
||||
console.log(`Got update, ${updates} remaining`);
|
||||
|
||||
if (updates == 0) {
|
||||
inst.componentDidUpdate = cdu;
|
||||
resolve();
|
||||
}
|
||||
|
||||
if (cdu) cdu(prevProps, prevState, snapshot);
|
||||
|
||||
inst.componentDidUpdate = cdu;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user