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 './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 @@ -35,7 +35,8 @@ export function useUpload(parentResource: Resource): UseUploadResult {
3535 ) ;
3636 const allUploaded = [ ...netUploaded ] ;
3737 setIsUploading ( false ) ;
38- setSubResources ( [ ...subResources , ...allUploaded ] ) ;
38+ await setSubResources ( [ ...subResources , ...allUploaded ] ) ;
39+ await parentResource . save ( store ) ;
3940
4041 return allUploaded ;
4142 } catch ( e ) {
Original file line number Diff line number Diff line change @@ -58,11 +58,13 @@ function New(): JSX.Element {
5858 }
5959
6060 const onUploadComplete = useCallback (
61- ( files : string [ ] ) => {
62- toast . success ( `Uploaded ${ files . length } files.` ) ;
61+ ( fileSubjects : string [ ] ) => {
62+ toast . success ( `Uploaded ${ fileSubjects . length } files.` ) ;
6363
64- if ( parentSubject ) {
64+ if ( fileSubjects . length > 1 && parentSubject ) {
6565 navigate ( constructOpenURL ( parentSubject ) ) ;
66+ } else {
67+ navigate ( constructOpenURL ( fileSubjects [ 0 ] ) ) ;
6668 }
6769 } ,
6870 [ parentSubject , navigate ] ,
You can’t perform that action at this time.
0 commit comments