Fetch event from server if not in storage

This commit is contained in:
Danila Fedorin 2021-09-09 11:30:19 -07:00
parent 2501bad4b4
commit 57c4070505

View file

@ -555,8 +555,13 @@ export class BaseRoom extends EventEmitter {
const observable = this._observedEvents.observe(eventId, entry); const observable = this._observedEvents.observe(eventId, entry);
if (!entry) { if (!entry) {
// update in the background // update in the background
this._readEventById(eventId).then(entry => { this._readEventById(eventId).then(async entry => {
if (entry) {
observable.update(entry); observable.update(entry);
} else {
const fectchedEntry = await this._fetchContext(eventId);
observable.update(fectchedEntry);
}
}).catch(err => { }).catch(err => {
console.warn(`could not load event ${eventId} from storage`, err); console.warn(`could not load event ${eventId} from storage`, err);
}); });