Skip to content

Commit dd2d232

Browse files
adamdotdevinbjesus
andcommitted
fix: add fallback for when crypto.randomUUID is unavailable
Closes #11452 Co-authored-by: Yo'av Moshe <bjesus@users.noreply.github.com>
1 parent 993ac55 commit dd2d232

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

packages/app/src/components/prompt-input/attachments.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function createPromptAttachments(input: PromptAttachmentsInput) {
3131
const dataUrl = reader.result as string
3232
const attachment: ImageAttachmentPart = {
3333
type: "image",
34-
id: crypto.randomUUID(),
34+
id: crypto.randomUUID?.() ?? Math.random().toString(16).slice(2),
3535
filename: file.name,
3636
mime: file.type,
3737
dataUrl,

packages/app/src/context/comments.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function createCommentSessionState(store: Store<CommentStore>, setStore: SetStor
5353

5454
const add = (input: Omit<LineComment, "id" | "time">) => {
5555
const next: LineComment = {
56-
id: crypto.randomUUID(),
56+
id: crypto.randomUUID?.() ?? Math.random().toString(16).slice(2),
5757
time: Date.now(),
5858
...input,
5959
}

0 commit comments

Comments
 (0)