@@ -1192,15 +1192,17 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
11921192 this . syncApi . stop ( ) ;
11931193 }
11941194
1195- const serverVersions = await this . getVersions ( ) ;
1196- this . canSupport = await buildFeatureSupportMap ( serverVersions ) ;
1197-
1198- const support = this . canSupport . get ( Feature . ThreadUnreadNotifications ) ;
1199- UNREAD_THREAD_NOTIFICATIONS . setPreferUnstable ( support === ServerSupport . Unstable ) ;
1195+ try {
1196+ await this . getVersions ( ) ;
12001197
1201- const { threads, list } = await this . doesServerSupportThread ( ) ;
1202- Thread . setServerSideSupport ( threads ) ;
1203- Thread . setServerSideListSupport ( list ) ;
1198+ // This should be done with `canSupport`
1199+ // TODO: https://github.com/vector-im/element-web/issues/23643
1200+ const { threads, list } = await this . doesServerSupportThread ( ) ;
1201+ Thread . setServerSideSupport ( threads ) ;
1202+ Thread . setServerSideListSupport ( list ) ;
1203+ } catch ( e ) {
1204+ logger . error ( "Can't fetch server versions, continuing to initialise sync, this will be retried later" , e ) ;
1205+ }
12041206
12051207 // shallow-copy the opts dict before modifying and storing it
12061208 this . clientOpts = Object . assign ( { } , opts ) as IStoredClientOpts ;
@@ -6518,7 +6520,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
65186520 * unstable APIs it supports
65196521 * @return {Promise<object> } The server /versions response
65206522 */
6521- public getVersions ( ) : Promise < IServerVersions > {
6523+ public async getVersions ( ) : Promise < IServerVersions > {
65226524 if ( this . serverVersionsPromise ) {
65236525 return this . serverVersionsPromise ;
65246526 }
@@ -6530,13 +6532,20 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
65306532 {
65316533 prefix : '' ,
65326534 } ,
6533- ) . catch ( ( e : Error ) => {
6535+ ) . catch ( e => {
65346536 // Need to unset this if it fails, otherwise we'll never retry
65356537 this . serverVersionsPromise = null ;
65366538 // but rethrow the exception to anything that was waiting
65376539 throw e ;
65386540 } ) ;
65396541
6542+ const serverVersions = await this . serverVersionsPromise ;
6543+ this . canSupport = await buildFeatureSupportMap ( serverVersions ) ;
6544+
6545+ // We can set flag values to use their stable or unstable version
6546+ const support = this . canSupport . get ( Feature . ThreadUnreadNotifications ) ;
6547+ UNREAD_THREAD_NOTIFICATIONS . setPreferUnstable ( support === ServerSupport . Unstable ) ;
6548+
65406549 return this . serverVersionsPromise ;
65416550 }
65426551
@@ -7703,15 +7712,6 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
77037712 * @param {string= } opts.type Content-type for the upload. Defaults to
77047713 * <tt>file.type</tt>, or <tt>applicaton/octet-stream</tt>.
77057714 *
7706- * @param {boolean= } opts.rawResponse Return the raw body, rather than
7707- * parsing the JSON. Defaults to false (except on node.js, where it
7708- * defaults to true for backwards compatibility).
7709- *
7710- * @param {boolean= } opts.onlyContentUri Just return the content URI,
7711- * rather than the whole body. Defaults to false (except on browsers,
7712- * where it defaults to true for backwards compatibility). Ignored if
7713- * opts.rawResponse is true.
7714- *
77157715 * @param {Function= } opts.progressHandler Optional. Called when a chunk of
77167716 * data has been uploaded, with an object containing the fields `loaded`
77177717 * (number of bytes transferred) and `total` (total size, if known).
@@ -7884,7 +7884,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
78847884 * @return {module:http-api.MatrixError } Rejects: with an error response.
78857885 */
78867886 public setPassword (
7887- authDict : any ,
7887+ authDict : IAuthDict ,
78887888 newPassword : string ,
78897889 logoutDevices ?: boolean ,
78907890 ) : Promise < { } > {
0 commit comments