From ddbb446dec65fa92ba836360a4708a01da412cc1 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 17 Nov 2023 16:28:23 +0100 Subject: [PATCH] simpler code --- .../lib/core-server/src/presets/common-override-preset.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/code/lib/core-server/src/presets/common-override-preset.ts b/code/lib/core-server/src/presets/common-override-preset.ts index 345dfa106850..d92dead5d8f4 100644 --- a/code/lib/core-server/src/presets/common-override-preset.ts +++ b/code/lib/core-server/src/presets/common-override-preset.ts @@ -51,7 +51,7 @@ export const stories: PresetProperty<'stories', StorybookConfig> = async (entrie }; }) ) - ).reduce((acc, expanded, i) => { + ).flatMap((expanded, i) => { const filteredEntries = expanded.files.filter((s) => !s.endsWith('.mdx')); // only return the filtered entries when there is something to filter // as webpack is faster with unexpanded globs @@ -61,14 +61,12 @@ export const stories: PresetProperty<'stories', StorybookConfig> = async (entrie ...expanded, files: `**/${k}`, })); - acc.push(...items); } else { items = [list[i]]; } - acc.push(...items); - return acc; - }, []); + return items; + }); return result; } return entries;