mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Do not fill gap when offline
This commit is contained in:
parent
c898bcb46a
commit
b1fd5f1ad5
@ -16,6 +16,8 @@ limitations under the License.
|
|||||||
|
|
||||||
import {SimpleTile} from "./SimpleTile.js";
|
import {SimpleTile} from "./SimpleTile.js";
|
||||||
import {UpdateAction} from "../UpdateAction.js";
|
import {UpdateAction} from "../UpdateAction.js";
|
||||||
|
import {ConnectionError} from "../../../../../matrix/error.js";
|
||||||
|
import {ConnectionStatus} from "../../../../../matrix/net/Reconnector";
|
||||||
|
|
||||||
export class GapTile extends SimpleTile {
|
export class GapTile extends SimpleTile {
|
||||||
constructor(entry, options) {
|
constructor(entry, options) {
|
||||||
@ -29,6 +31,7 @@ export class GapTile extends SimpleTile {
|
|||||||
async fill() {
|
async fill() {
|
||||||
if (!this._loading && !this._entry.edgeReached) {
|
if (!this._loading && !this._entry.edgeReached) {
|
||||||
this._loading = true;
|
this._loading = true;
|
||||||
|
this._error = null;
|
||||||
this.emitChange("isLoading");
|
this.emitChange("isLoading");
|
||||||
try {
|
try {
|
||||||
await this._room.fillGap(this._entry, 10);
|
await this._room.fillGap(this._entry, 10);
|
||||||
@ -55,7 +58,15 @@ export class GapTile extends SimpleTile {
|
|||||||
let canFillMore;
|
let canFillMore;
|
||||||
this._siblingChanged = false;
|
this._siblingChanged = false;
|
||||||
do {
|
do {
|
||||||
|
try {
|
||||||
canFillMore = await this.fill();
|
canFillMore = await this.fill();
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
if (e instanceof ConnectionError) {
|
||||||
|
await this.options.client.reconnector.connectionStatus.waitFor(status => status === ConnectionStatus.Online).promise;
|
||||||
|
canFillMore = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
depth = depth + 1;
|
depth = depth + 1;
|
||||||
} while (depth < 10 && !this._siblingChanged && canFillMore && !this.isDisposed);
|
} while (depth < 10 && !this._siblingChanged && canFillMore && !this.isDisposed);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user