From ebe64aafacec8eaa69a5a1781fc159ff77bc884a Mon Sep 17 00:00:00 2001 From: "Pierre Pulinckx (pipu)" Date: Mon, 6 Nov 2023 13:39:18 +0100 Subject: [PATCH] [IMP] web: make model reload silent When a request to the server takes more than 3 seconds, the blockUI then prevents the user from taking another action. For example, when you want to apply several filters quickly, the blockUI appears and, in the end, you may want to apply yet another filter. In this commit, we remove the blockUI because we believe that blocking the user makes little sense. This only makes sense when installing a new application. task-3279095 closes odoo/odoo#140042 Signed-off-by: Aaron Bohy (aab) --- .../loading_indicator/loading_indicator.js | 4 -- .../webclient/loading_indicator_tests.js | 45 ------------------- 2 files changed, 49 deletions(-) diff --git a/addons/web/static/src/webclient/loading_indicator/loading_indicator.js b/addons/web/static/src/webclient/loading_indicator/loading_indicator.js index 61a84fc9c10..2dff7170bbf 100644 --- a/addons/web/static/src/webclient/loading_indicator/loading_indicator.js +++ b/addons/web/static/src/webclient/loading_indicator/loading_indicator.js @@ -41,10 +41,6 @@ export class LoadingIndicator extends Component { this.startShowTimer = browser.setTimeout(() => { if (this.state.count) { this.state.show = true; - this.blockUITimer = browser.setTimeout(() => { - this.shouldUnblock = true; - this.uiService.block(); - }, 3000); } }, 250); } diff --git a/addons/web/static/tests/webclient/loading_indicator_tests.js b/addons/web/static/tests/webclient/loading_indicator_tests.js index 3649eb77ad1..31385a17526 100644 --- a/addons/web/static/tests/webclient/loading_indicator_tests.js +++ b/addons/web/static/tests/webclient/loading_indicator_tests.js @@ -128,51 +128,6 @@ QUnit.test("displays the loading indicator for multi rpc in debug mode", async ( assert.strictEqual(loadingIndicator, null, "the loading indicator should not be displayed"); }); -QUnit.test("loading indicator blocks UI", async (assert) => { - const env = await makeTestEnv(); - patchWithCleanup(originalBrowser, { - setTimeout: async (callback, delay) => { - assert.step(`set timeout ${delay}`); - await Promise.resolve(); - callback(); - }, - }); - const ui = env.services.ui; - ui.bus.addEventListener("BLOCK", () => { - assert.step("block"); - }); - ui.bus.addEventListener("UNBLOCK", () => { - assert.step("unblock"); - }); - await mount(LoadingIndicator, target, { env }); - env.bus.trigger("RPC:REQUEST", payload(1)); - await nextTick(); - env.bus.trigger("RPC:RESPONSE", payload(1)); - await nextTick(); - assert.verifySteps(["set timeout 250", "set timeout 3000", "block", "unblock"]); -}); - -QUnit.test("loading indicator doesn't unblock ui if it didn't block it", async (assert) => { - const env = await makeTestEnv(); - const { execRegisteredTimeouts } = mockTimeout(); - const ui = env.services.ui; - ui.bus.addEventListener("BLOCK", () => { - assert.step("block"); - }); - ui.bus.addEventListener("UNBLOCK", () => { - assert.step("unblock"); - }); - await mount(LoadingIndicator, target, { env }); - env.bus.trigger("RPC:REQUEST", payload(1)); - execRegisteredTimeouts(); - env.bus.trigger("RPC:RESPONSE", payload(1)); - assert.verifySteps(["block", "unblock"]); - env.bus.trigger("RPC:REQUEST", payload(2)); - env.bus.trigger("RPC:RESPONSE", payload(2)); - execRegisteredTimeouts(); - assert.verifySteps([]); -}); - QUnit.test("loading indicator is not displayed immediately", async (assert) => { const env = await makeTestEnv(); const { advanceTime } = mockTimeout();