Recover from sync errors
This commit is contained in:
parent
26dad81e06
commit
99374bbe00
1 changed files with 3 additions and 1 deletions
|
@ -19,10 +19,12 @@ import matrix from "matrix-js-sdk/src/browser-index";
|
|||
|
||||
function waitForSync(client) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const onSync = (state) => {
|
||||
const onSync = (state, _old, data) => {
|
||||
if (state === "PREPARED") {
|
||||
resolve();
|
||||
client.removeListener("sync", onSync);
|
||||
} else if (state === "ERROR") {
|
||||
reject(data?.error);
|
||||
}
|
||||
};
|
||||
client.on("sync", onSync);
|
||||
|
|
Loading…
Add table
Reference in a new issue