From 103b57b2493187b89a84ea564f2fae6a1679ab26 Mon Sep 17 00:00:00 2001 From: Diamond Lewis Date: Wed, 14 Aug 2019 21:00:59 -0500 Subject: [PATCH] fix(FileEditor): Error: Tried to encode an unsaved file --- src/components/FileEditor/FileEditor.react.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/FileEditor/FileEditor.react.js b/src/components/FileEditor/FileEditor.react.js index a3c06cafe9..e0be0ca3b9 100644 --- a/src/components/FileEditor/FileEditor.react.js +++ b/src/components/FileEditor/FileEditor.react.js @@ -54,10 +54,12 @@ export default class FileEditor extends React.Component { } async handleChange(e) { - let file = e.target.files[0]; + const file = e.target.files[0]; if (file) { - let base64 = await this.getBase64(file); - this.props.onCommit(new Parse.File(file.name, { base64 })); + const base64 = await this.getBase64(file); + const parseFile = new Parse.File(file.name, { base64 }); + await parseFile.save(); + this.props.onCommit(parseFile); } }