diff --git a/Composer/packages/client/src/pages/language-generation/code-editor.tsx b/Composer/packages/client/src/pages/language-generation/code-editor.tsx index f0d58d7e52..e80b9bdaa7 100644 --- a/Composer/packages/client/src/pages/language-generation/code-editor.tsx +++ b/Composer/packages/client/src/pages/language-generation/code-editor.tsx @@ -29,7 +29,6 @@ const CodeEditor: React.FC = props => { const { fileId } = props; const file = lgFiles?.find(({ id }) => id === 'common'); const [diagnostics, setDiagnostics] = useState(get(file, 'diagnostics', [])); - const [content, setContent] = useState(''); const [errorMsg, setErrorMsg] = useState(''); const [lgEditor, setLgEditor] = useState(null); @@ -47,6 +46,7 @@ const CodeEditor: React.FC = props => { const line = Array.isArray(hashLine) ? +hashLine[0] : typeof hashLine === 'string' ? +hashLine : undefined; const inlineMode = !!template; + const [content, setContent] = useState(template?.body || file?.content); useEffect(() => { // reset content with file.content's initial state