Skip to content

Commit 656eef7

Browse files
authored
Merge pull request #152 from StrongMonkey/fix-slug-replacement
Fix: use ReplaceAll to replace space when contructing slug
2 parents bcdfdac + ba2b8fd commit 656eef7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

components/scripts/create.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default function Create() {
1818

1919
const handleSubmit = async () => {
2020
const defaultName = "New Assistant";
21-
const slug = defaultName.toLowerCase().replace(" ", "-") + "-" + Math.random().toString(36).substring(2, 7);
21+
const slug = defaultName.toLowerCase().replaceAll(" ", "-") + "-" + Math.random().toString(36).substring(2, 7);
2222
createScript({
2323
displayName: defaultName,
2424
slug,

contexts/edit.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ const EditContextProvider: React.FC<EditContextProps> = ({scriptPath, children})
178178
// Only update slug when displayName has changed
179179
if (existing?.displayName !== root.name) {
180180
toUpdate.displayName = root.name;
181-
toUpdate.slug = toUpdate.displayName?.toLowerCase().replace(" ", "-") + "-" + Math.random().toString(36).substring(2, 7);
181+
toUpdate.slug = toUpdate.displayName?.toLowerCase().replaceAll(" ", "-") + "-" + Math.random().toString(36).substring(2, 7);
182182
} else {
183183
toUpdate.slug = existing?.slug;
184184
}

0 commit comments

Comments
 (0)