mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
Check in all entries for context
This commit is contained in:
parent
73733ce145
commit
5c1813888c
@ -337,12 +337,12 @@ export class Timeline {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches an entry with the given event-id from remoteEntries or contextEntriesNotInTimeline.
|
||||
* Fetches an entry with the given event-id from localEntries, remoteEntries or contextEntriesNotInTimeline.
|
||||
* @param {string} eventId event-id of the entry
|
||||
* @returns entry if found, undefined otherwise
|
||||
*/
|
||||
_findLoadedEventById(eventId) {
|
||||
return this.getByEventId(eventId) ?? this._contextEntriesNotInTimeline.get(eventId);
|
||||
return this.getFromAllEntriesById(eventId) ?? this._contextEntriesNotInTimeline.get(eventId);
|
||||
}
|
||||
|
||||
async _getEventFromStorage(eventId) {
|
||||
@ -421,6 +421,16 @@ export class Timeline {
|
||||
return null;
|
||||
}
|
||||
|
||||
getFromAllEntriesById(eventId) {
|
||||
for (let i = 0; i < this.entries.length; i += 1) {
|
||||
const entry = this.entries.get(i);
|
||||
if (entry.id === eventId) {
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
get entries() {
|
||||
return this._allEntries;
|
||||
|
Loading…
Reference in New Issue
Block a user