Skip to content

Commit 23b3ebb

Browse files
authored
Merge pull request #191 from PRO-Robotech/feature/dev
possible logs fix
2 parents 59a3fb5 + 02d9993 commit 23b3ebb

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@prorobotech/openapi-k8s-toolkit",
3-
"version": "0.0.1-alpha.133",
3+
"version": "0.0.1-alpha.134",
44
"description": "ProRobotech OpenAPI k8s tools",
55
"main": "dist/openapi-k8s-toolkit.cjs.js",
66
"module": "dist/openapi-k8s-toolkit.es.js",

src/components/molecules/Terminals/PodLogsMonaco/molecules/MonacoEditor/MonacoEditor.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,12 @@ export const MonacoEditor: FC<TMonacoEditorProps> = ({
3535
const socketRef = useRef<WebSocket | null>(null)
3636
const editorRef = useRef<monaco.editor.IStandaloneCodeEditor | null>(null)
3737

38+
const [editorReady, setEditorReady] = useState<boolean>(false)
39+
3840
// Handle editor mount
3941
const handleEditorDidMount = (editor: monaco.editor.IStandaloneCodeEditor) => {
4042
editorRef.current = editor
43+
setEditorReady(true)
4144
}
4245

4346
// Append content to editor
@@ -56,6 +59,10 @@ export const MonacoEditor: FC<TMonacoEditorProps> = ({
5659
}
5760

5861
useEffect(() => {
62+
if (!editorReady) {
63+
return undefined
64+
}
65+
5966
const socket = new WebSocket(endpoint)
6067
socketRef.current = socket
6168

@@ -96,7 +103,7 @@ export const MonacoEditor: FC<TMonacoEditorProps> = ({
96103
socket.close()
97104
}
98105
}
99-
}, [endpoint, namespace, podName, container, previous])
106+
}, [endpoint, namespace, podName, container, previous, editorReady])
100107

101108
return (
102109
<>
@@ -133,7 +140,7 @@ export const MonacoEditor: FC<TMonacoEditorProps> = ({
133140
defaultLanguage="plaintext"
134141
language="plaintext"
135142
width="100%"
136-
height={`calc(100vh - ${substractHeight}px`}
143+
height={`calc(100vh - ${substractHeight}px)`}
137144
theme={theme === 'dark' ? 'vs-dark' : theme === undefined ? 'vs-dark' : 'vs'}
138145
options={{
139146
theme: theme === 'dark' ? 'vs-dark' : theme === undefined ? 'vs-dark' : 'vs',

0 commit comments

Comments
 (0)