From 94ae33858d3915ce1163bd00a4e7bda32f84048c Mon Sep 17 00:00:00 2001 From: Fabien 'egg' O'Carroll Date: Tue, 3 May 2022 12:01:23 +0100 Subject: [PATCH] Fixed mergeDates zero and one item in list (#2360) The exit clause of the mergeDates function should return an array rather than an object, to ensure that an array is always returned. Because we are using the concat method when recursing, this continues to work for longer lists. We want to return an empty array if list is empty, this protects against returning [undefined] --- ghost/admin/app/services/dashboard-stats.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ghost/admin/app/services/dashboard-stats.js b/ghost/admin/app/services/dashboard-stats.js index a9ce465452..8f42d91b27 100644 --- a/ghost/admin/app/services/dashboard-stats.js +++ b/ghost/admin/app/services/dashboard-stats.js @@ -376,7 +376,7 @@ export default class DashboardStatsService extends Service { const [current, ...rest] = list; if (!current) { - return entry; + return entry ? [entry] : []; } if (!entry) {