Skip to content

Commit

Permalink
fix(client): remove non-letter chart from random id (#1193)
Browse files Browse the repository at this point in the history
  • Loading branch information
danilowoz authored Sep 5, 2024
1 parent f7ac596 commit c7d4113
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sandpack-react/src/presets/CustomSandpack.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ export const ExperimentalServiceWorker: React.FC = () => {
`,
}}
options={{
bundlerURL: "https://nqfrns-3000.csb.app/",
experimental_enableServiceWorker: true,
experimental_enableStableServiceWorkerId: true,
}}
template="react"
/>
Expand Down
5 changes: 4 additions & 1 deletion sandpack-react/src/utils/useAsyncSandpackId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ export const useAsyncSandpackId = (files: SandpackBundlerFiles) => {
.join("|||");
const sha = await generateShortId(allCode + reactDomId);

return ensureLength(sha.replace(/:/g, "sp"), MAX_ID_LENGTH);
return ensureLength(
sha.replace(/:/g, "sp").replace(/[^a-zA-Z]/g, ""),
MAX_ID_LENGTH
);
};
} else {
return () => ensureLength(generateRandomId(), MAX_ID_LENGTH);
Expand Down

0 comments on commit c7d4113

Please sign in to comment.