diff --git a/sandpack-react/src/presets/CustomSandpack.stories.tsx b/sandpack-react/src/presets/CustomSandpack.stories.tsx index ce5276ff..6044a2b1 100644 --- a/sandpack-react/src/presets/CustomSandpack.stories.tsx +++ b/sandpack-react/src/presets/CustomSandpack.stories.tsx @@ -55,8 +55,8 @@ export const ExperimentalServiceWorker: React.FC = () => { `, }} options={{ - bundlerURL: "https://nqfrns-3000.csb.app/", experimental_enableServiceWorker: true, + experimental_enableStableServiceWorkerId: true, }} template="react" /> diff --git a/sandpack-react/src/utils/useAsyncSandpackId.ts b/sandpack-react/src/utils/useAsyncSandpackId.ts index b4b0dd81..312bb281 100644 --- a/sandpack-react/src/utils/useAsyncSandpackId.ts +++ b/sandpack-react/src/utils/useAsyncSandpackId.ts @@ -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);