Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions frontend/src/components/terminal/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</template>

<script lang="ts" setup>
import { ref, watch, onBeforeUnmount, nextTick, computed, onMounted } from 'vue';
import { ref, shallowRef, watch, onBeforeUnmount, nextTick, computed, onMounted } from 'vue';
import { Terminal } from '@xterm/xterm';
import '@xterm/xterm/css/xterm.css';
import { FitAddon } from '@xterm/addon-fit';
Expand All @@ -32,7 +32,7 @@ const terminalElement = ref<HTMLDivElement | null>(null);
const fitAddon = new FitAddon();
const termReady = ref(false);
const webSocketReady = ref(false);
const term = ref();
const term = shallowRef<Terminal>();
const terminalSocket = ref<WebSocket>();
const heartbeatTimer = ref<NodeJS.Timer>();
let initWebSocketToken = 0;
Expand Down Expand Up @@ -88,9 +88,9 @@ watch([backgroundColor, foregroundColor], ([newBackgroundColor, newForegroundCol
applyTerminalBackground(newBackgroundColor);
});
const cursorStyle = computed(() => terminalStore.cursorStyle);
watch(cursorStyle, (newCursorStyle) => {
watch(cursorStyle, () => {
if (!term.value) return;
term.value.options.cursorStyle = newCursorStyle;
term.value.options.cursorStyle = getStyle();
});
const cursorBlink = computed(() => terminalStore.cursorBlink);
watch(cursorBlink, (newCursorBlink) => {
Expand Down Expand Up @@ -294,6 +294,7 @@ const showWebSocketAuthError = (message: string) => {

const runRealTerminal = () => {
webSocketReady.value = true;
term.value?.focus();
if (initCmd.value !== '') {
hideInitCmdEcho.value = true;
initCmdEchoBuffer.value = '';
Expand Down Expand Up @@ -339,7 +340,6 @@ const onWSReceive = (message: MessageEvent) => {
const wsMsg = JSON.parse(message.data);
switch (wsMsg.type) {
case 'cmd': {
term.value.element && term.value.focus();
if (wsMsg.data) {
let receiveMsg = decodeBase64(wsMsg.data);
if (hideInitCmdEcho.value) {
Expand Down
Loading