diff --git a/resources/scripts/components/elements/AceEditor.tsx b/resources/scripts/components/elements/AceEditor.tsx index fbea88b8f..47fba4edb 100644 --- a/resources/scripts/components/elements/AceEditor.tsx +++ b/resources/scripts/components/elements/AceEditor.tsx @@ -28,7 +28,7 @@ export interface Props { filename?: string; onModeChanged: (mode: string) => void; fetchContent: (callback: () => Promise) => void; - onContentSaved: (content: string) => void; + onContentSaved: () => void; } export default ({ style, initialContent, filename, mode, fetchContent, onContentSaved, onModeChanged }: Props) => { @@ -70,7 +70,7 @@ export default ({ style, initialContent, filename, mode, fetchContent, onContent editor.commands.addCommand({ name: 'Save', bindKey: { win: 'Ctrl-s', mac: 'Command-s' }, - exec: (editor: Editor) => onContentSaved(editor.session.getValue()), + exec: () => onContentSaved(), }); fetchContent(() => Promise.resolve(editor.session.getValue())); diff --git a/resources/scripts/components/server/files/FileEditContainer.tsx b/resources/scripts/components/server/files/FileEditContainer.tsx index 4106ad53d..8ad40f72d 100644 --- a/resources/scripts/components/server/files/FileEditContainer.tsx +++ b/resources/scripts/components/server/files/FileEditContainer.tsx @@ -35,19 +35,19 @@ export default () => { let fetchFileContent: null | (() => Promise) = null; - if (action !== 'new') { - useEffect(() => { - setLoading(true); - setError(''); - getFileContents(uuid, hash.replace(/^#/, '')) - .then(setContent) - .catch(error => { - console.error(error); - setError(httpErrorToHuman(error)); - }) - .then(() => setLoading(false)); - }, [ uuid, hash ]); - } + useEffect(() => { + if (action === 'new') return; + + setLoading(true); + setError(''); + getFileContents(uuid, hash.replace(/^#/, '')) + .then(setContent) + .catch(error => { + console.error(error); + setError(httpErrorToHuman(error)); + }) + .then(() => setLoading(false)); + }, [ action, uuid, hash ]); const save = (name?: string) => { if (!fetchFileContent) {