From b40be693ee2bc71c9c3e74bf4e40615c85257b8d Mon Sep 17 00:00:00 2001 From: Jaybe Date: Sun, 7 Dec 2025 20:57:19 +0900 Subject: [PATCH] =?UTF-8?q?=EC=8A=AC=EB=9F=AC=EA=B7=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/editor/page.tsx | 21 ++++----------------- tests/unit/EditorServerAutosave.spec.tsx | 1 + 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/app/editor/page.tsx b/src/app/editor/page.tsx index 1222313..48ff460 100644 --- a/src/app/editor/page.tsx +++ b/src/app/editor/page.tsx @@ -226,24 +226,11 @@ function EditorPageInner() { return; } - const now = new Date(); - const datePart = [ - now.getFullYear().toString().padStart(4, "0"), - (now.getMonth() + 1).toString().padStart(2, "0"), - now.getDate().toString().padStart(2, "0"), - ].join(""); + const randomSlug = Array.from({ length: 12 }, () => + Math.floor(Math.random() * 36).toString(36), + ).join(""); - const timePart = [ - now.getHours().toString().padStart(2, "0"), - now.getMinutes().toString().padStart(2, "0"), - now.getSeconds().toString().padStart(2, "0"), - ].join(""); - - const randomPart = Math.random().toString(36).slice(2, 6); - - const generatedSlug = `page-${datePart}-${timePart}-${randomPart}`; - - updateProjectConfig({ slug: generatedSlug }); + updateProjectConfig({ slug: randomSlug }); }, [searchParams, projectConfig?.slug, updateProjectConfig]); useEffect(() => { diff --git a/tests/unit/EditorServerAutosave.spec.tsx b/tests/unit/EditorServerAutosave.spec.tsx index b32984d..90747de 100644 --- a/tests/unit/EditorServerAutosave.spec.tsx +++ b/tests/unit/EditorServerAutosave.spec.tsx @@ -169,6 +169,7 @@ describe("EditorPage - 서버 자동 저장", () => { expect(typeof body.slug).toBe("string"); expect(body.slug).not.toBe("my-landing"); + expect(body.slug.startsWith("page-")).toBe(false); expect(mockState.projectConfig.slug).toBe(body.slug); });