fixed: [BUG] crypto.randomUUID is not a function Runtime Error #205. Added fallback function with manual UUID generation if crypto.randomUUID() was not available.

This commit is contained in:
Sanjit K
2025-07-12 00:14:03 -05:00
parent fd017d6aca
commit 799fd2981a
5 changed files with 44 additions and 10 deletions

View File

@ -1,6 +1,7 @@
import { create } from "zustand";
import { storageService } from "@/lib/storage/storage-service";
import { useTimelineStore } from "./timeline-store";
import { generateUUID } from "@/lib/utils";
export type MediaType = "image" | "video" | "audio";
@ -161,7 +162,7 @@ export const useMediaStore = create<MediaStore>((set, get) => ({
addMediaItem: async (projectId, item) => {
const newItem: MediaItem = {
...item,
id: crypto.randomUUID(),
id: generateUUID(),
};
// Add to local state immediately for UI responsiveness