Fetch event from server if not in storage
This commit is contained in:
parent
2501bad4b4
commit
57c4070505
1 changed files with 7 additions and 2 deletions
|
@ -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 => {
|
||||||
observable.update(entry);
|
if (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);
|
||||||
});
|
});
|
||||||
|
|
Reference in a new issue