Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
danilowoz committed Sep 10, 2024
1 parent 7a6be6e commit 898d658
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 1 addition & 4 deletions sandpack-react/src/contexts/utils/useClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ import type {
SandpackStatus,
} from "../..";
import { generateRandomId } from "../../utils/stringUtils";
import {
MAX_SANDPACK_ID_LENGTH,
useAsyncSandpackId,
} from "../../utils/useAsyncSandpackId";
import { useAsyncSandpackId } from "../../utils/useAsyncSandpackId";

import type { FilesState } from "./useFiles";

Expand Down
6 changes: 3 additions & 3 deletions sandpack-react/src/utils/useAsyncSandpackId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const useSandpackId = () => {
* For example, this id will be used to mount SW in the iframe
* so, to keep the URL valid, this must be an 9 character long string
*/
export const MAX_SANDPACK_ID_LENGTH = 9;
const MAX_ID_LENGTH = 9;

export const useAsyncSandpackId = (files: SandpackBundlerFiles) => {
if (typeof useReactId === "function") {
Expand All @@ -31,11 +31,11 @@ export const useAsyncSandpackId = (files: SandpackBundlerFiles) => {

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

Expand Down

0 comments on commit 898d658

Please sign in to comment.