Skip to content

Commit 3246522

Browse files
authored
Remove # from tags (codesandbox#3334)
1 parent 4cd160f commit 3246522

File tree

1 file changed

+5
-3
lines changed
  • packages/app/src/app/overmind/namespaces/workspace

1 file changed

+5
-3
lines changed

packages/app/src/app/overmind/namespaces/workspace/actions.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ export const tagAdded: AsyncAction = withOwnedSandbox(
2222
const { tagName } = state.workspace.tags;
2323
const sandbox = state.editor.currentSandbox;
2424

25-
sandbox.tags.push(tagName);
25+
const cleanTag = tagName.replace(/#/g, '');
26+
27+
sandbox.tags.push(cleanTag);
2628

2729
try {
28-
sandbox.tags = await effects.api.createTag(sandbox.id, tagName);
30+
sandbox.tags = await effects.api.createTag(sandbox.id, cleanTag);
2931

3032
await actions.editor.internal.updateSandboxPackageJson();
3133
} catch (error) {
32-
const index = sandbox.tags.indexOf(tagName);
34+
const index = sandbox.tags.indexOf(cleanTag);
3335
sandbox.tags.splice(index, 1);
3436
actions.internal.handleError({ message: 'Unable to add tag', error });
3537
}

0 commit comments

Comments
 (0)