From 1ff715bd8810c6d934a68bc47b581b2317582c9f Mon Sep 17 00:00:00 2001 From: Alec Aivazis Date: Sun, 3 Dec 2023 15:00:46 -0800 Subject: [PATCH] Fix bug when dash is present in react route (#1236) --- .changeset/curvy-apes-fry.md | 5 +++++ e2e/react/src/routes/{hello => hello-world}/+page.gql | 0 e2e/react/src/routes/{hello => hello-world}/+page.tsx | 0 packages/houdini/src/lib/router/conventions.ts | 2 +- 4 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/curvy-apes-fry.md rename e2e/react/src/routes/{hello => hello-world}/+page.gql (100%) rename e2e/react/src/routes/{hello => hello-world}/+page.tsx (100%) diff --git a/.changeset/curvy-apes-fry.md b/.changeset/curvy-apes-fry.md new file mode 100644 index 000000000..cb88ac56a --- /dev/null +++ b/.changeset/curvy-apes-fry.md @@ -0,0 +1,5 @@ +--- +'houdini-react': patch +--- + +Fix bug when dash present in route name diff --git a/e2e/react/src/routes/hello/+page.gql b/e2e/react/src/routes/hello-world/+page.gql similarity index 100% rename from e2e/react/src/routes/hello/+page.gql rename to e2e/react/src/routes/hello-world/+page.gql diff --git a/e2e/react/src/routes/hello/+page.tsx b/e2e/react/src/routes/hello-world/+page.tsx similarity index 100% rename from e2e/react/src/routes/hello/+page.tsx rename to e2e/react/src/routes/hello-world/+page.tsx diff --git a/packages/houdini/src/lib/router/conventions.ts b/packages/houdini/src/lib/router/conventions.ts index fdf698d88..e524c113b 100644 --- a/packages/houdini/src/lib/router/conventions.ts +++ b/packages/houdini/src/lib/router/conventions.ts @@ -98,7 +98,7 @@ export function page_id(path: string) { if (path.endsWith('/') && path.length > 1) { path = path.substring(0, path.length - 1) } - const special_chars = ['/', ']', '[', '(', ')'] + const special_chars = ['/', ']', '[', '(', ')', '-'] const mask = '_' let copy = ''