File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed
components/forms/FileDropzone Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -8,11 +8,11 @@ import { useUpload } from '../../../hooks/useUpload';
88
99export interface FileDropzoneInputProps {
1010 parentResource : Resource ;
11- onFilesUploaded ?: ( files : string [ ] ) => void ;
1211 text ?: string ;
1312 maxFiles ?: number ;
1413 className ?: string ;
1514 accept ?: string [ ] ;
15+ onFilesUploaded ?: ( fileSubjects : string [ ] ) => void ;
1616}
1717
1818/**
Original file line number Diff line number Diff line change @@ -39,7 +39,8 @@ export function useUpload(parentResource: Resource): UseUploadResult {
3939 ) ;
4040 const allUploaded = [ ...netUploaded ] ;
4141 setIsUploading ( false ) ;
42- setSubResources ( [ ...subResources , ...allUploaded ] ) ;
42+ await setSubResources ( [ ...subResources , ...allUploaded ] ) ;
43+ await parentResource . save ( store ) ;
4344
4445 return allUploaded ;
4546 } catch ( e ) {
Original file line number Diff line number Diff line change @@ -67,11 +67,13 @@ function NewResourceSelector() {
6767 }
6868
6969 const onUploadComplete = useCallback (
70- ( files : string [ ] ) => {
71- toast . success ( `Uploaded ${ files . length } files.` ) ;
70+ ( fileSubjects : string [ ] ) => {
71+ toast . success ( `Uploaded ${ fileSubjects . length } files.` ) ;
7272
73- if ( parentSubject ) {
73+ if ( fileSubjects . length > 1 && parentSubject ) {
7474 navigate ( constructOpenURL ( parentSubject ) ) ;
75+ } else {
76+ navigate ( constructOpenURL ( fileSubjects [ 0 ] ) ) ;
7577 }
7678 } ,
7779 [ parentSubject , navigate ] ,
You can’t perform that action at this time.
0 commit comments