Skip to content

Commit 8b3d4f9

Browse files
committed
chore: revert non-params replacement
1 parent b0c261b commit 8b3d4f9

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

.changeset/late-drinks-cut.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"astro-loader-i18n": patch
3+
"astro-nanostores-i18n": patch
4+
---
5+
6+
Revert non-param replacement

libs/astro-utils-i18n/src/utils/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export function buildPath(routePattern: RoutePattern, segmentValues: Segments, b
7272
return segmentValues[segment.value];
7373
}
7474

75-
return segmentValues[segment.value] ?? `${segment.value}`;
75+
return `${segment.value}`;
7676
})
7777
);
7878
}

libs/astro-utils-i18n/test/utils/__snapshots__/route.spec.ts.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
exports[`buildPath > should build valid paths 1`] = `"/blog/bli/bla/blub/comments/2"`;
44

5-
exports[`buildPath > should replace non params with segments 1`] = `"/blog/bli/bla/blub/kommentare/2"`;
6-
75
exports[`buildPath > should throw if is filled with a path and param is not spread 1`] = `[Error: The segment value "bli/bla/blub" for route segment "slug" contains a slash. Did you forget to add "..." to the route pattern?]`;
86

97
exports[`buildPath > should throw if no segment matches a param 1`] = `[Error: No segment value found for route segment "slug". Did you forget to provide it?]`;

libs/astro-utils-i18n/test/utils/route.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,4 @@ describe("buildPath", () => {
5454
const routePattern = parseRoutePattern("/blog/[...slug]/comments/[commentId]");
5555
expect(buildPath(routePattern, { slug: "bli/bla/blub", commentId: "2" }, "/")).toMatchSnapshot();
5656
});
57-
it("should replace non params with segments", () => {
58-
const routePattern = parseRoutePattern("/blog/[...slug]/comments/[commentId]");
59-
expect(buildPath(routePattern, { slug: "bli/bla/blub", commentId: "2", comments: "kommentare" }, "/")).toMatchSnapshot();
60-
});
6157
});

0 commit comments

Comments
 (0)