Skip to content

Commit 870f99e

Browse files
committed
fix mix of async/await and .then
1 parent f986f78 commit 870f99e

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/components/file/useFile.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,17 +144,14 @@ function useFile({
144144
}, [writeable, authentication, repository, branch, file, onSaveCache]);
145145

146146
const save = useDeepCompareCallback(async (_content) => {
147-
//console.log("GRT save // will save file");
148-
await saveFile({
149-
authentication, repository, branch, file, content: _content,
150-
}).then(
151-
// Empty cache if user has saved this file
147+
try {
148+
await saveFile({ authentication, repository, branch, file, content: _content });
152149
// (save() will not happen for "OFFLINE" system files)
153-
async() => {
154-
await saveCache(null);
155-
await load();
156-
}
157-
);
150+
await saveCache(); // Empty cache if user has saved this file
151+
await load();
152+
} catch (e) {
153+
console.log(e);
154+
};
158155
}, [writeable, authentication, repository, branch, file, load, saveFile, saveCache]);
159156

160157
const dangerouslyDelete = useDeepCompareCallback(async () => {

0 commit comments

Comments
 (0)