refactor: consolidate upload helpers
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import type { FolderEntry } from '@/lib/client-types'
|
||||
import { revokeEntryUrls } from '@/lib/client-object-urls'
|
||||
import { useSecret } from '@/hooks/useSecret'
|
||||
import { useFolderEntries } from '@/hooks/useFolderEntries'
|
||||
import { useUploadOrchestrator } from '@/hooks/useUploadOrchestrator'
|
||||
@@ -60,12 +61,7 @@ export default function UploadZone() {
|
||||
})
|
||||
|
||||
const handleFolderSelected = (entry: FolderEntry) => {
|
||||
entries.forEach((current) => {
|
||||
const urls = new Set<string>()
|
||||
if (current.modelUrl) urls.add(current.modelUrl)
|
||||
Object.values(current.assetUrls || {}).forEach((url) => urls.add(url))
|
||||
urls.forEach((url) => URL.revokeObjectURL(url))
|
||||
})
|
||||
entries.forEach(revokeEntryUrls)
|
||||
setGlobalError(null)
|
||||
setEntries([entry])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user