Skip to content

Commit

Permalink
set initial content not empty (#1804)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhixzhan authored Dec 26, 2019
1 parent 52c46aa commit 90321f8
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const CodeEditor: React.FC<CodeEditorProps> = 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<editor.IStandaloneCodeEditor | null>(null);

Expand All @@ -47,6 +46,7 @@ const CodeEditor: React.FC<CodeEditorProps> = 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
Expand Down

0 comments on commit 90321f8

Please sign in to comment.