Skip to content

Commit

Permalink
Switch sliding sync support to simplified sliding sync
Browse files Browse the repository at this point in the history
Experimental PR to test js-sdk with simlified sliding sync.

This does not maintain support for regulaer sliding sync.
  • Loading branch information
dbkr committed Sep 12, 2024
1 parent 05ba27f commit 65762c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9929,7 +9929,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
const clientTimeout = req.clientTimeout;
delete req.clientTimeout;
return this.http.authedRequest<MSC3575SlidingSyncResponse>(Method.Post, "/sync", qps, req, {
prefix: "/_matrix/client/unstable/org.matrix.msc3575",
prefix: "/_matrix/client/unstable/org.matrix.simplified_msc3575",
baseUrl: proxyBaseUrl,
localTimeoutMs: clientTimeout,
abortSignal,
Expand Down
12 changes: 6 additions & 6 deletions src/sliding-sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,13 +461,13 @@ export class SlidingSync extends TypedEventEmitter<SlidingSyncEvent, SlidingSync
* (or rejects with the transaction ID if the action was not applied e.g the request was cancelled
* immediately after sending, in which case the action will be applied in the subsequent request)
*/
public setListRanges(key: string, ranges: number[][]): Promise<string> {
public setListRanges(key: string, ranges: number[][]): void {
const list = this.lists.get(key);
if (!list) {
return Promise.reject(new Error("no list with key " + key));
throw new Error("no list with key " + key);
}
list.updateListRange(ranges);
return this.resend();
//return this.resend();
}

/**
Expand All @@ -479,7 +479,7 @@ export class SlidingSync extends TypedEventEmitter<SlidingSyncEvent, SlidingSync
* (or rejects with the transaction ID if the action was not applied e.g the request was cancelled
* immediately after sending, in which case the action will be applied in the subsequent request)
*/
public setList(key: string, list: MSC3575List): Promise<string> {
public setList(key: string, list: MSC3575List): void {
const existingList = this.lists.get(key);
if (existingList) {
existingList.replaceList(list);
Expand All @@ -488,7 +488,7 @@ export class SlidingSync extends TypedEventEmitter<SlidingSyncEvent, SlidingSync
this.lists.set(key, new SlidingList(list));
}
this.listModifiedCount += 1;
return this.resend();
//return this.resend();
}

/**
Expand Down Expand Up @@ -842,7 +842,7 @@ export class SlidingSync extends TypedEventEmitter<SlidingSyncEvent, SlidingSync
const listModifiedCount = this.listModifiedCount;
const reqLists: Record<string, MSC3575List> = {};
this.lists.forEach((l: SlidingList, key: string) => {
reqLists[key] = l.getList(false);
reqLists[key] = l.getList(true);
});
const reqBody: MSC3575SlidingSyncRequest = {
lists: reqLists,
Expand Down

0 comments on commit 65762c4

Please sign in to comment.