MM-25831 Fix timing issue with cancelPing (#4394)

With `getUrl` recently [becoming async](https://github.com/mattermost/mattermost-mobile/commit/293470ff#diff-60b06b1c4aab028b96d9b207e84000c6R316), the global definition of the cancelPing function wasn't being made available in time for use by other functions (e.g. `handleSslProblem` and `handleConnect`)
This commit is contained in:
Mattermost Build 2020-06-08 19:24:16 +02:00 committed by GitHub
parent 21e1466068
commit 8a95000bd0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -313,10 +313,6 @@ export default class SelectServer extends PureComponent {
error: null,
});
const serverUrl = await this.getUrl(url, !retryWithHttp);
Client4.setUrl(serverUrl);
handleServerUrlChanged(serverUrl);
let cancel = false;
this.cancelPing = () => {
cancel = true;
@ -329,6 +325,10 @@ export default class SelectServer extends PureComponent {
this.cancelPing = null;
};
const serverUrl = await this.getUrl(url, !retryWithHttp);
Client4.setUrl(serverUrl);
handleServerUrlChanged(serverUrl);
try {
const result = await getPing();