mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-15 11:58:34 +08:00
fix(ui): channel binding picker shows agents created after page mount
This commit is contained in:
parent
a7fdbceb48
commit
e756219bdc
@ -226,8 +226,13 @@ let isActive = true
|
|||||||
// ==================== Lifecycle ====================
|
// ==================== Lifecycle ====================
|
||||||
|
|
||||||
async function loadAgents() {
|
async function loadAgents() {
|
||||||
const res: any = await agentApi.list()
|
try {
|
||||||
agents.value = res.data || []
|
const res: any = await agentApi.list()
|
||||||
|
agents.value = res.data || []
|
||||||
|
} catch {
|
||||||
|
// Keep the previously loaded list — the agent picker degrades to
|
||||||
|
// slightly stale options instead of surfacing a hard error.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function startStatusPolling() {
|
function startStatusPolling() {
|
||||||
@ -260,6 +265,10 @@ onActivated(() => {
|
|||||||
isActive = true
|
isActive = true
|
||||||
if (isInitialLoading.value) return
|
if (isInitialLoading.value) return
|
||||||
loadStatus()
|
loadStatus()
|
||||||
|
// The route is kept-alive, so returning from the Agents page re-activates
|
||||||
|
// (not re-mounts) this component — refresh the agent list here or the
|
||||||
|
// binding picker keeps offering the stale set from the first mount.
|
||||||
|
loadAgents()
|
||||||
startStatusPolling()
|
startStatusPolling()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -442,11 +451,15 @@ function getConnectionTooltip(channel: Channel): string {
|
|||||||
// ==================== Modal control ====================
|
// ==================== Modal control ====================
|
||||||
|
|
||||||
function openCreateModal() {
|
function openCreateModal() {
|
||||||
// RFC-084: New channel always starts with the type picker so the wizard
|
// New channel always starts with the type picker so the wizard can
|
||||||
// can specialize Step 1 to the picked service. Editing an existing
|
// specialize Step 1 to the picked service. Editing an existing channel
|
||||||
// channel still goes straight to the legacy modal via openEditModal.
|
// still goes straight to the legacy modal via openEditModal.
|
||||||
editingChannel.value = null
|
editingChannel.value = null
|
||||||
modalDefaults.value = {}
|
modalDefaults.value = {}
|
||||||
|
// Fire-and-forget refresh so agents created since the last load (this
|
||||||
|
// page is kept-alive) appear in the binding picker; the reactive prop
|
||||||
|
// updates the open dialog in place when the response lands.
|
||||||
|
loadAgents()
|
||||||
showTypePicker.value = true
|
showTypePicker.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,6 +482,8 @@ async function onWizardCreated(_channel: Channel) {
|
|||||||
function openEditModal(channel: Channel) {
|
function openEditModal(channel: Channel) {
|
||||||
editingChannel.value = channel
|
editingChannel.value = channel
|
||||||
modalDefaults.value = {}
|
modalDefaults.value = {}
|
||||||
|
// Same stale-picker guard as openCreateModal.
|
||||||
|
loadAgents()
|
||||||
showModal.value = true
|
showModal.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user