[FIX] web: discard rejected reloadProms in magicReload
Steps to reproduce: - Go to a list view with multiple items - Click on an item - Delete it - Go back in history twice (Using the browser navigation) to return to the list view -> We can't click on another record opw-2854113 closes odoo/odoo#103808 X-original-commit: 92c90823139b413c8289d1c323ad694fc8220a61 Signed-off-by: Hubert Van De Walle <huvw@odoo.com> Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
@@ -263,7 +263,7 @@ function useMagicLegacyReload() {
|
||||
widget.reload = function (...args) {
|
||||
manualReload = true;
|
||||
legacyReloadProm = controllerReload.call(widget, ...args);
|
||||
return legacyReloadProm.then(() => {
|
||||
return legacyReloadProm.finally(() => {
|
||||
if (manualReload) {
|
||||
legacyReloadProm = null;
|
||||
manualReload = false;
|
||||
@@ -277,7 +277,7 @@ function useMagicLegacyReload() {
|
||||
if (manualUpdate) {
|
||||
legacyReloadProm = updateProm;
|
||||
}
|
||||
return updateProm.then(() => {
|
||||
return updateProm.finally(() => {
|
||||
if (manualUpdate) {
|
||||
legacyReloadProm = null;
|
||||
}
|
||||
|
||||
@@ -580,6 +580,55 @@ QUnit.module("ActionManager", (hooks) => {
|
||||
assert.containsN(target, ".o_data_row", 5);
|
||||
});
|
||||
|
||||
QUnit.test("A new form view can be reloaded after a failed one", async function (assert) {
|
||||
assert.expect(5);
|
||||
const webClient = await createWebClient({serverData});
|
||||
|
||||
await doAction(webClient, 3);
|
||||
await cpHelpers.switchView(target, "list");
|
||||
assert.containsOnce(target, ".o_list_view", "The list view should be displayed");
|
||||
|
||||
// Click on the first record
|
||||
await testUtils.dom.click($(target).find(".o_list_view .o_data_row:first .o_data_cell:first"));
|
||||
await legacyExtraNextTick();
|
||||
assert.containsOnce(target, ".o_form_view", "The form view should be displayed");
|
||||
|
||||
// Delete the current record
|
||||
await testUtils.controlPanel.toggleActionMenu(target);
|
||||
await testUtils.dom.click(
|
||||
Array.from(document.querySelectorAll('.o_menu_item')).find(e => e.textContent === "Delete")
|
||||
);
|
||||
await legacyExtraNextTick();
|
||||
assert.containsOnce(target, ".modal", "a confirm modal should be displayed");
|
||||
await testUtils.dom.click(target.querySelector(".modal-footer button.btn-primary"));
|
||||
await legacyExtraNextTick();
|
||||
|
||||
// The form view is automatically switched to the next record
|
||||
// Go back to the previous (now deleted) record
|
||||
webClient.env.bus.trigger("test:hashchange", {
|
||||
model: "partner",
|
||||
id: 1,
|
||||
action: 3,
|
||||
view_type: "form",
|
||||
});
|
||||
await legacyExtraNextTick();
|
||||
|
||||
// Go back to the list view
|
||||
webClient.env.bus.trigger("test:hashchange", {
|
||||
model: "partner",
|
||||
action: 3,
|
||||
view_type: "list",
|
||||
});
|
||||
await legacyExtraNextTick();
|
||||
await legacyExtraNextTick();
|
||||
assert.containsOnce(target, ".o_list_view", "should still display the list view");
|
||||
|
||||
await testUtils.dom.click($(target).find(".o_list_view .o_data_row:first .o_data_cell:first"));
|
||||
await legacyExtraNextTick();
|
||||
assert.containsOnce(target, ".o_form_view",
|
||||
"The form view should still load after a previous failed update | reload");
|
||||
});
|
||||
|
||||
QUnit.test("there is no flickering when switching between views", async function (assert) {
|
||||
assert.expect(20);
|
||||
let def;
|
||||
|
||||
Reference in New Issue
Block a user