When replaceSession changed the session ID from pending-XXX to a real UUID, Vue's :key="session.id" treated it as a new element, destroyed and recreated TerminalInstance, which called connectToHost again, got another UUID, replaced again — infinite loop. Added a stable `key` field to sessions that never changes after creation, used as the Vue :key instead of the mutable `id`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
19 lines
522 B
Vue
19 lines
522 B
Vue
<script setup lang="ts">
|
|
import { useSessionStore } from '~/stores/session.store'
|
|
|
|
const sessions = useSessionStore()
|
|
</script>
|
|
|
|
<template>
|
|
<div class="flex h-8 bg-gray-950 border-b border-gray-800 overflow-x-auto shrink-0">
|
|
<SessionTab
|
|
v-for="session in sessions.sessions"
|
|
:key="session.key"
|
|
:session="session"
|
|
:is-active="session.id === sessions.activeSessionId"
|
|
@activate="sessions.setActive(session.id)"
|
|
@close="sessions.removeSession(session.id)"
|
|
/>
|
|
</div>
|
|
</template>
|