From bc3cf622dc534819d50ee7a701b844ddcbda63b9 Mon Sep 17 00:00:00 2001 From: hoeppner-dataport Date: Wed, 3 Jul 2024 16:50:00 +0200 Subject: [PATCH 1/2] increase minimum wait time for fetchCards --- src/modules/data/board/cardActions/cardSocketApi.composable.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/data/board/cardActions/cardSocketApi.composable.ts b/src/modules/data/board/cardActions/cardSocketApi.composable.ts index 38793be778..a4e7f81240 100644 --- a/src/modules/data/board/cardActions/cardSocketApi.composable.ts +++ b/src/modules/data/board/cardActions/cardSocketApi.composable.ts @@ -20,7 +20,7 @@ import { useBoardAriaNotification } from "../ariaNotification/ariaLiveNotificati export const useCardSocketApi = () => { const cardStore = useCardStore(); - const WAIT_AFTER_LAST_CALL_IN_MS = 5; + const WAIT_AFTER_LAST_CALL_IN_MS = 30; const MAX_WAIT_BEFORE_FIRST_CALL_IN_MS = 200; let cardIdsToFetch: string[] = []; From f53145277c1d152f109e71c5aac27e4a12fe840c Mon Sep 17 00:00:00 2001 From: hoeppner-dataport Date: Mon, 8 Jul 2024 13:29:32 +0200 Subject: [PATCH 2/2] split fetchCard requests into batches --- .../data/board/cardActions/cardSocketApi.composable.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/data/board/cardActions/cardSocketApi.composable.ts b/src/modules/data/board/cardActions/cardSocketApi.composable.ts index a4e7f81240..cc0c08fd97 100644 --- a/src/modules/data/board/cardActions/cardSocketApi.composable.ts +++ b/src/modules/data/board/cardActions/cardSocketApi.composable.ts @@ -1,3 +1,4 @@ +import { chunk } from "lodash"; import * as CardActions from "./cardActions"; import { useSocketConnection } from "@data-board"; import { useCardStore } from "../Card.store"; @@ -92,7 +93,10 @@ export const useCardSocketApi = () => { const _debouncedFetchCardEmit = useDebounceFn( () => { - emitOnSocket("fetch-card-request", { cardIds: cardIdsToFetch }); + const batches = chunk(cardIdsToFetch, 50); + batches.forEach((cardIds) => + emitOnSocket("fetch-card-request", { cardIds }) + ); cardIdsToFetch = []; }, WAIT_AFTER_LAST_CALL_IN_MS,