diff --git a/web/static/src/ts/widgets/root.ts b/web/static/src/ts/widgets/root.ts index 919867c8..f6416798 100644 --- a/web/static/src/ts/widgets/root.ts +++ b/web/static/src/ts/widgets/root.ts @@ -41,7 +41,6 @@ interface State { stack: ActionStack; inHome: boolean; currentApp: MenuItem | null; - isLoading: boolean; } //------------------------------------------------------------------------------ @@ -56,8 +55,7 @@ export class Root extends Widget { notifications: [], stack: [], inHome: false, - currentApp: null, - isLoading: false + currentApp: null }; constructor(env: Env, props: Props) { @@ -77,7 +75,8 @@ export class Root extends Widget { // loading indicator this.env.ajax.on("rpc_status", this, status => { - this.updateState({ isLoading: status === "loading" }); + const method = status === "loading" ? "remove" : "add"; + (this.refs.loading_indicator).classList[method]("d-none"); }); // actions diff --git a/web/static/src/xml/templates.xml b/web/static/src/xml/templates.xml index 98cb856b..d051bb40 100644 --- a/web/static/src/xml/templates.xml +++ b/web/static/src/xml/templates.xml @@ -14,7 +14,7 @@ -
Loading
+
Loading
diff --git a/web/static/tests/widgets/__snapshots__/root.test.ts.snap b/web/static/tests/widgets/__snapshots__/root.test.ts.snap index b6fc733e..4d14f4a6 100644 --- a/web/static/tests/widgets/__snapshots__/root.test.ts.snap +++ b/web/static/tests/widgets/__snapshots__/root.test.ts.snap @@ -31,7 +31,7 @@ exports[`can be rendered (in home menu) 1`] = `
- +
Loading
" `; @@ -107,7 +107,7 @@ exports[`if url has action_id, will render action and navigate to proper menu_id
- +
Loading
" `; @@ -174,6 +174,6 @@ exports[`start with no action => clicks on client action => discuss is rendered
- +
Loading
" `;