Skip to content

Commit

Permalink
[IMP] pivot: do not delay update by default
Browse files Browse the repository at this point in the history
Before this commit, the pivot definition was updated only after the
user clicked on the "Update" button. This could be confusing for the
user, as the pivot definition was not updated when the user changed
the pivot configuration.

closes #4304

Task: 3953753
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
  • Loading branch information
pro-odoo committed Jun 11, 2024
1 parent 82cacd7 commit d62c476
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class PivotSidePanelStore extends SpreadsheetStore {
"update",
] as const;

private updatesAreDeferred: boolean = true;
private updatesAreDeferred: boolean = false;
private draft: PivotCoreDefinition | null = null;
constructor(get: Get, private pivotId: UID) {
super(get);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ describe("Spreadsheet pivot side panel", () => {
addPivot(model, "A1:A3", {}, "3");
env.openSidePanel("PivotSidePanel", { pivotId: "3" });
await nextTick();
await click(fixture.querySelector(".pivot-defer-update input")!);
await click(fixture.querySelector(".add-dimension")!);
expect(fixture.querySelector(".o-popover")).toBeDefined();
await click(fixture, ".o-autocomplete-value");
Expand All @@ -66,6 +67,7 @@ describe("Spreadsheet pivot side panel", () => {
});

test("it should not defer update when the dataset is updated", async () => {
await click(fixture.querySelector(".pivot-defer-update input")!);
expect((fixture.querySelector(".pivot-defer-update input")! as HTMLInputElement).checked).toBe(
true
);
Expand Down Expand Up @@ -119,13 +121,13 @@ describe("Spreadsheet pivot side panel", () => {
await click(fixture.querySelector(".add-dimension")!);
expect(fixture.querySelector(".o-popover")).toBeDefined();
await click(fixture, ".o-autocomplete-value");
await click(fixture.querySelector(".sp_apply_update")!);
expect(model.getters.getPivotCoreDefinition("3").columns).toEqual([
{ name: "amount", order: "asc" },
]);
});

test("should reset side panel if discard is clicked", async () => {
await click(fixture.querySelector(".pivot-defer-update input")!);
expect(fixture.querySelectorAll(".pivot-dimension")).toHaveLength(0);
await click(fixture.querySelector(".add-dimension")!);
expect(fixture.querySelector(".o-popover")).toBeDefined();
Expand Down

0 comments on commit d62c476

Please sign in to comment.