Skip to content

Commit

Permalink
[REV] collaborative: always trigger collaborative event received
Browse files Browse the repository at this point in the history
In commit 30e1e37, we removed the bus signal when receiving the
server response of our own message but that feature can be useful
to evaluate the connection status with the said-server.
This is used in our integration within Odoo.

closes #5477

Task: 0
X-original-commit: 5c945f6
Signed-off-by: Vincent Schippefilt (vsc) <[email protected]>
  • Loading branch information
rrahir committed Jan 14, 2025
1 parent 0c5220e commit e1d8501
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
3 changes: 0 additions & 3 deletions src/collaborative/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,6 @@ export class Session extends EventBus<CollaborativeEvent> {
}
}
this.acknowledge(message);
if (message.type === "REMOTE_REVISION" && message.clientId === this.clientId) {
return;
}
this.trigger("collaborative-event-received");
}

Expand Down
7 changes: 7 additions & 0 deletions tests/collaborative/collaborative.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ describe("Multi users synchronisation", () => {
expect(called).toBe(false);
});

test("The server response to our own message is signaled", () => {
let notif = jest.fn();
alice["session"].on("collaborative-event-received", alice, notif);
setCellContent(alice, "A1", "salut");
expect(notif).toHaveBeenCalled();
});

test("Can export data after leaving the session", () => {
alice.leaveSession();
alice.exportData();
Expand Down
6 changes: 4 additions & 2 deletions tests/top_bar_component.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ describe("Topbar svg icon", () => {
});
});

test("Clicking on a topbar button only trigger a single render", async () => {
test("Clicking on a topbar button triggers two renders", async () => {
jest.useFakeTimers();
const transportService = new MockTransportService();

Expand All @@ -919,5 +919,7 @@ test("Clicking on a topbar button only trigger a single render", async () => {

await click(fixture, ".o-spreadsheet-topbar [title='Bold (Ctrl+B)']");

expect(triggerRender).toHaveBeenCalledTimes(1);
// one render from the collaboration session
// one from the top bar interaction
expect(triggerRender).toHaveBeenCalledTimes(2);
});

0 comments on commit e1d8501

Please sign in to comment.