Fix playbooks not getting updated by websocket (#9088) (#9093)

(cherry picked from commit 4978269156)

Co-authored-by: Daniel Espino García <larkox@gmail.com>
This commit is contained in:
Mattermost Build 2025-09-01 08:55:43 +03:00 committed by GitHub
parent dc02a7b825
commit 6a86cccda0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View file

@ -120,6 +120,20 @@ describe('fetchPlaybookRunsForChannel', () => {
expect(handlePlaybookRuns).not.toHaveBeenCalled();
});
it('should update the channel in the ephemeral store when there are no runs', async () => {
mockClient.fetchPlaybookRuns.mockResolvedValueOnce({
items: [],
has_more: false,
});
const result = await fetchPlaybookRunsForChannel(serverUrl, channelId);
expect(result).toBeDefined();
expect(result.error).toBeUndefined();
expect(result.runs).toEqual([]);
expect(handlePlaybookRuns).not.toHaveBeenCalled();
expect(EphemeralStore.getChannelPlaybooksSynced(serverUrl, channelId)).toBe(true);
});
it('should update the channel in the ephemeral store', async () => {
mockClient.fetchPlaybookRuns.mockResolvedValueOnce({
items: [mockPlaybookRun],

View file

@ -45,6 +45,7 @@ export const fetchPlaybookRunsForChannel = async (serverUrl: string, channelId:
}
if (!allRuns.length) {
EphemeralStore.setChannelPlaybooksSynced(serverUrl, channelId);
return {runs: []};
}