From ee19f46f4bb5504e044a9a93c98a61af723910cf Mon Sep 17 00:00:00 2001 From: kumburovicbranko682-boop Date: Sun, 28 Jun 2026 08:44:21 +0800 Subject: [PATCH] refactor(ladle): getfileid extracts incorrect file id for multi-dot filenames `split(".")[0]` takes everything before the *first* dot, not before the last dot (the extension). For a filename like `widget.v2.stories.tsx`, this returns `widget` instead of `widget.v2`. Two files `widget.v1.stories.tsx` and `widget.v2.stories.tsx` would produce the same file ID, causing a spurious duplicate story ID error from `detectDuplicateStoryNames` even though the filenames are legitimately different. This is a silent correctness bug in the naming pipeline. Affected files: naming-utils.js Signed-off-by: kumburovicbranko682-boop <295886834+kumburovicbranko682-boop@users.noreply.github.com> --- packages/ladle/lib/cli/vite-plugin/naming-utils.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/ladle/lib/cli/vite-plugin/naming-utils.js b/packages/ladle/lib/cli/vite-plugin/naming-utils.js index 254f1257..144859dc 100644 --- a/packages/ladle/lib/cli/vite-plugin/naming-utils.js +++ b/packages/ladle/lib/cli/vite-plugin/naming-utils.js @@ -55,7 +55,9 @@ export const titleToFileId = (title) => */ export const getFileId = (filename) => { const pathParts = filename.split("/"); - return pathParts[pathParts.length - 1].split(".")[0]; + const nameParts = pathParts[pathParts.length - 1].split("."); + nameParts.pop(); + return nameParts.join("."); }; /**