aboutsummaryrefslogtreecommitdiff
path: root/src/fields/Doc.ts
diff options
context:
space:
mode:
authormehekj <mehek.jethani@gmail.com>2022-09-20 11:52:44 -0400
committermehekj <mehek.jethani@gmail.com>2022-09-20 11:52:44 -0400
commit945c0cd12fb2a792d10800f81b52cbac8aa12a41 (patch)
treebad726c19905e6bf8910d96d0b79eaff1b319457 /src/fields/Doc.ts
parent87096243391cf172c26190897c79321b3d42817c (diff)
display error instead of infinitely loading after refresh
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r--src/fields/Doc.ts22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts
index cf505c45b..74a3d8cf2 100644
--- a/src/fields/Doc.ts
+++ b/src/fields/Doc.ts
@@ -149,6 +149,28 @@ export class Doc extends RefField {
public static set MainDocId(id: string | undefined) {
this.mainDocId = id;
}
+
+ @observable public static CurrentlyLoading: Doc[];
+ // removes from currently loading display
+ @action
+ public static removeCurrentlyLoading(doc: Doc) {
+ if (Doc.CurrentlyLoading) {
+ const index = Doc.CurrentlyLoading.indexOf(doc);
+ index !== -1 && Doc.CurrentlyLoading.splice(index, 1);
+ }
+ }
+
+ // adds doc to currently loading display
+ @action
+ public static addCurrentlyLoading(doc: Doc) {
+ if (!Doc.CurrentlyLoading) {
+ Doc.CurrentlyLoading = [];
+ }
+ if (Doc.CurrentlyLoading.indexOf(doc) === -1) {
+ Doc.CurrentlyLoading.push(doc);
+ }
+ }
+
@observable public static GuestDashboard: Doc | undefined;
@observable public static GuestTarget: Doc | undefined;
@observable public static GuestMobile: Doc | undefined;