@@ -37,10 +37,11 @@ function useFile({
3737 const branch = repository && ( repository . branch || repository . default_branch ) ;
3838 const [ deleted , setDeleted ] = useState ( ) ;
3939
40- const _setBlob = useCallback ( ( _blob ) => {
41- if ( blob && _blob && onConfirmClose ) {
42- if ( onConfirmClose ( ) )
43- {
40+ const _setBlob = useCallback ( async ( _blob ) => {
41+ if ( blob && _blob && typeof onConfirmClose == 'function' ) {
42+ const confirm = await onConfirmClose ( )
43+
44+ if ( confirm ) {
4445 setBlob ( _blob ) ;
4546 }
4647 } else {
@@ -179,6 +180,12 @@ function useFile({
179180 update ( ) ;
180181 } , [ update , blobActions , onFilepath ] ) ;
181182
183+ const saveCache = useCallback ( async ( content ) => {
184+ if ( onSaveCache ) {
185+ await onSaveCache ( { authentication, repository, branch, file, content} ) ;
186+ }
187+ } , [ writeable , authentication , repository , branch , file , onSaveCache ] ) ;
188+
182189 const save = useCallback ( async ( content ) => {
183190 console . log ( "GRT save // will save file" ) ;
184191 await saveFile ( {
@@ -196,12 +203,6 @@ function useFile({
196203 ) ;
197204 } , [ writeable , authentication , repository , branch , file , load , saveFile , saveCache ] ) ;
198205
199- const saveCache = useCallback ( async ( content ) => {
200- if ( onSaveCache ) {
201- await onSaveCache ( { authentication, repository, branch, file, content} ) ;
202- }
203- } , [ writeable , authentication , repository , branch , file , onSaveCache ] ) ;
204-
205206 const dangerouslyDelete = useCallback ( async ( ) => {
206207 if ( writeable ) {
207208 const _deleted = await deleteFile ( {
0 commit comments