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,7 +8,7 @@ import { useUpload } from '../../../hooks/useUpload';
88
99export interface FileDropzoneInputProps {
1010 parentResource : Resource ;
11- onFilesUploaded ?: ( files : string [ ] ) => void ;
11+ onFilesUploaded ?: ( fileSubjects : string [ ] ) => void ;
1212}
1313
1414/**
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 @@ -57,11 +57,13 @@ function New(): JSX.Element {
5757 }
5858
5959 const onUploadComplete = useCallback (
60- ( files : string [ ] ) => {
61- toast . success ( `Uploaded ${ files . length } files.` ) ;
60+ ( fileSubjects : string [ ] ) => {
61+ toast . success ( `Uploaded ${ fileSubjects . length } files.` ) ;
6262
63- if ( parentSubject ) {
63+ if ( fileSubjects . length > 1 && parentSubject ) {
6464 navigate ( constructOpenURL ( parentSubject ) ) ;
65+ } else {
66+ navigate ( constructOpenURL ( fileSubjects [ 0 ] ) ) ;
6567 }
6668 } ,
6769 [ parentSubject , navigate ] ,
You can’t perform that action at this time.
0 commit comments