mirror of
https://github.com/esphome/esp-web-tools.git
synced 2025-07-28 14:16:41 +00:00
Retry fetching Wi-Fi ssids (#391)
This commit is contained in:
parent
2f736cbc80
commit
f92e0988d3
@ -736,7 +736,7 @@ export class EwtInstallDialog extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _updateSsids() {
|
private async _updateSsids(tries = 0) {
|
||||||
const oldSsids = this._ssids;
|
const oldSsids = this._ssids;
|
||||||
this._ssids = undefined;
|
this._ssids = undefined;
|
||||||
this._busy = true;
|
this._busy = true;
|
||||||
@ -746,7 +746,7 @@ export class EwtInstallDialog extends LitElement {
|
|||||||
try {
|
try {
|
||||||
ssids = await this._client!.scan();
|
ssids = await this._client!.scan();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// When we fail on first load, pick "Join other"
|
// When we fail while loading, pick "Join other"
|
||||||
if (this._ssids === undefined) {
|
if (this._ssids === undefined) {
|
||||||
this._ssids = null;
|
this._ssids = null;
|
||||||
this._selectedSsid = null;
|
this._selectedSsid = null;
|
||||||
@ -755,6 +755,13 @@ export class EwtInstallDialog extends LitElement {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We will retry a few times if we don't get any results
|
||||||
|
if (ssids.length === 0 && tries < 3) {
|
||||||
|
console.log("SCHEDULE RETRY", tries);
|
||||||
|
setTimeout(() => this._updateSsids(tries + 1), 1000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (oldSsids) {
|
if (oldSsids) {
|
||||||
// If we had a previous list, ensure the selection is still valid
|
// If we had a previous list, ensure the selection is still valid
|
||||||
if (
|
if (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user