Skip to content

Commit 647ef0f

Browse files
committed
ignore lint error
1 parent ef69f45 commit 647ef0f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/components/YamlEditor/YamlEditor.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { Editor } from '@monaco-editor/react';
2-
import type { ComponentProps } from 'react';
2+
import { ComponentProps, useEffect, useCallback, useMemo, useState } from 'react';
33
import { Button, Panel, Toolbar, ToolbarSpacer, Title } from '@ui5/webcomponents-react';
44
import { parseDocument } from 'yaml';
5-
import { useCallback, useMemo, useState } from 'react';
65
import { useTheme } from '../../hooks/useTheme';
76
import { GITHUB_DARK_DEFAULT, GITHUB_LIGHT_DEFAULT } from '../../lib/monaco.ts';
87
import { useTranslation } from 'react-i18next';
@@ -23,6 +22,13 @@ export const YamlEditor = (props: YamlEditorProps) => {
2322
const [validationErrors, setValidationErrors] = useState<string[]>([]);
2423
const [applyAttempted, setApplyAttempted] = useState(false);
2524

25+
useEffect(() => {
26+
if (typeof value !== 'undefined') {
27+
// eslint-disable-next-line react-hooks/set-state-in-effect
28+
setEditorContent(value.toString());
29+
}
30+
}, [value]);
31+
2632
const enforcedOptions: monaco.editor.IStandaloneEditorConstructionOptions = useMemo(
2733
() => ({
2834
...(options as monaco.editor.IStandaloneEditorConstructionOptions),

0 commit comments

Comments
 (0)