This is an automated email from the ASF dual-hosted git repository.

marat pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git


The following commit(s) were added to refs/heads/main by this push:
     new b0199d5b Fix #1131
b0199d5b is described below

commit b0199d5bb1abce7a8ff9824b06327fa9ae49dde2
Author: Marat Gubaidullin <[email protected]>
AuthorDate: Mon Feb 19 13:40:50 2024 -0500

    Fix #1131
---
 karavan-web/karavan-app/src/main/webui/src/project/FileEditor.tsx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/karavan-web/karavan-app/src/main/webui/src/project/FileEditor.tsx 
b/karavan-web/karavan-app/src/main/webui/src/project/FileEditor.tsx
index 2d891f46..dcea5772 100644
--- a/karavan-web/karavan-app/src/main/webui/src/project/FileEditor.tsx
+++ b/karavan-web/karavan-app/src/main/webui/src/project/FileEditor.tsx
@@ -45,8 +45,10 @@ export function FileEditor(props: Props) {
     const [propertyPlaceholders, setPropertyPlaceholders] = 
useState<string[]>([]);
     const [beans, setBeans] = useState<RegistryBeanDefinition[]>([]);
     const [key, setKey] = useState<string>(Math.random().toString());
+    const [code, setCode] = useState<string>();
 
     useEffect(() => {
+        setCode(file?.code);
         const pp = CodeUtils.getPropertyPlaceholders(files);
         setPropertyPlaceholders(prevState => {
             prevState.length = 0;
@@ -139,7 +141,7 @@ export function FileEditor(props: Props) {
                 height="100vh"
                 defaultLanguage={language}
                 theme={'light'}
-                value={file.code}
+                value={code}
                 className={'code-editor'}
                 onChange={(value, ev) => {
                     if (value) {

Reply via email to