From d90f6c201961af3745654c11047b0b6b865c25b1 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Fri, 11 Nov 2022 16:51:21 +0100 Subject: [PATCH] Fixed mercure integration --- src/tags/reducers/tagsList.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/tags/reducers/tagsList.ts b/src/tags/reducers/tagsList.ts index cdd55d26..da15e123 100644 --- a/src/tags/reducers/tagsList.ts +++ b/src/tags/reducers/tagsList.ts @@ -49,10 +49,13 @@ const increaseVisitsForTags = (tags: TagIncrease[], stats: TagsStatsMap) => tags const tagStats = theStats[tag]; - tagStats.visitsCount += increase; - theStats[tag] = tagStats; // eslint-disable-line no-param-reassign - - return theStats; + return { + ...theStats, + [tag]: { + ...tagStats, + visitsCount: tagStats.visitsCount + increase, + }, + }; }, { ...stats }); const calculateVisitsPerTag = (createdVisits: CreateVisit[]): TagIncrease[] => Object.entries( createdVisits.reduce((acc, { shortUrl }) => {