fix: add fallback for when crypto.randomUUID is unavailable
Closes #11452 Co-authored-by: Yo'av Moshe <bjesus@users.noreply.github.com>
This commit is contained in:
@@ -31,7 +31,7 @@ export function createPromptAttachments(input: PromptAttachmentsInput) {
|
|||||||
const dataUrl = reader.result as string
|
const dataUrl = reader.result as string
|
||||||
const attachment: ImageAttachmentPart = {
|
const attachment: ImageAttachmentPart = {
|
||||||
type: "image",
|
type: "image",
|
||||||
id: crypto.randomUUID(),
|
id: crypto.randomUUID?.() ?? Math.random().toString(16).slice(2),
|
||||||
filename: file.name,
|
filename: file.name,
|
||||||
mime: file.type,
|
mime: file.type,
|
||||||
dataUrl,
|
dataUrl,
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ function createCommentSessionState(store: Store<CommentStore>, setStore: SetStor
|
|||||||
|
|
||||||
const add = (input: Omit<LineComment, "id" | "time">) => {
|
const add = (input: Omit<LineComment, "id" | "time">) => {
|
||||||
const next: LineComment = {
|
const next: LineComment = {
|
||||||
id: crypto.randomUUID(),
|
id: crypto.randomUUID?.() ?? Math.random().toString(16).slice(2),
|
||||||
time: Date.now(),
|
time: Date.now(),
|
||||||
...input,
|
...input,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user