Skip to content

Commit

Permalink
Fix incorrect assumptions about required fields in /search response (#…
Browse files Browse the repository at this point in the history
…4228)

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
  • Loading branch information
t3chguy authored Jun 6, 2024
1 parent 9fc557f commit fa5f2d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/@types/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ enum GroupKey {
}

export interface IResultRoomEvents {
count: number;
highlights: string[];
results: ISearchResult[];
count?: number;
highlights?: string[];
results?: ISearchResult[];
state?: { [roomId: string]: IStateEventWithRoomId[] };
groups?: {
[groupKey in GroupKey]: {
Expand Down
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7109,7 +7109,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
// append the new results to our existing results
const resultsLength = roomEvents.results?.length ?? 0;
for (let i = 0; i < resultsLength; i++) {
const sr = SearchResult.fromJson(roomEvents.results[i], mapper);
const sr = SearchResult.fromJson(roomEvents.results![i], mapper);
const room = this.getRoom(sr.context.getEvent().getRoomId());
if (room) {
// Copy over a known event sender if we can
Expand Down

0 comments on commit fa5f2d3

Please sign in to comment.