Skip to content

Commit

Permalink
[FIX] SplitIntoColumnsPanel: Panel closes instantly
Browse files Browse the repository at this point in the history
There was a mistake in the code adaptation when we introduced the
stores.

How to reproduce:
- Open a spreadsheet
- Open "Topbar menu > Split text to columns"
-> The sidepanel opens and closes instantly

closes #3937

Task: 3829192
X-original-commit: baaba22
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
  • Loading branch information
rrahir committed Mar 28, 2024
1 parent ac1d82f commit 53e580d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,14 @@ export class SplitIntoColumnsPanel extends Component<Props, SpreadsheetChildEnv>
const composerStore = useStore(ComposerStore);
// The feature makes no sense if we are editing a cell, because then the selection isn't active
// Stop the edition when the panel is mounted, and close the panel if the user start editing a cell
useEffect(this.props.onCloseSidePanel, () => [composerStore.editionMode]);
useEffect(
(editionMode) => {
if (editionMode !== "inactive") {
this.props.onCloseSidePanel();
}
},
() => [composerStore.editionMode]
);

onMounted(() => {
composerStore.stopEdition();
Expand Down
1 change: 1 addition & 0 deletions tests/split_to_column/split_to_columns_panel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ describe("split to columns sidePanel component", () => {
});

test("Panel is closed if the user starts to edit a cell", async () => {
expect(onCloseSidePanel).not.toHaveBeenCalled();
const composerStore = parent.env.getStore(ComposerStore);
composerStore.startEdition();
await nextTick();
Expand Down

0 comments on commit 53e580d

Please sign in to comment.