Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't erase well known data when the fetch fails #2498

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6408,9 +6408,13 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
private async fetchClientWellKnown(): Promise<void> {
// `getRawClientConfig` does not throw or reject on network errors, instead
// it absorbs errors and returns `{}`.
this.clientWellKnownPromise = AutoDiscovery.getRawClientConfig(this.getDomain());
this.clientWellKnown = await this.clientWellKnownPromise;
this.emit(ClientEvent.ClientWellKnown, this.clientWellKnown);
// In order to not override the existing well-known we first check to see if there is any data at all
const rawClientConfig = AutoDiscovery.getRawClientConfig(this.getDomain());
if( Object.keys(rawClientConfig).length !== 0) {
this.clientWellKnownPromise = rawClientConfig;
this.clientWellKnown = await this.clientWellKnownPromise;
this.emit(ClientEvent.ClientWellKnown, this.clientWellKnown);
}
}

public getClientWellKnown(): IClientWellKnown {
Expand Down