fix: briefing refresh — weather not populated + workspace conv bleed
Two bugs: 1. Manual 'Refresh' button didn't refresh weather/RSS before compiling. The daily scheduler calls refresh_all_feeds + refresh_location_cache before run_compilation; the manual trigger route called run_compilation directly, reading a stale cache. Manual trigger now mirrors the scheduler: refresh feeds and all configured weather locations first. 2. Navigating to WorkspaceView during a long briefing compilation caused the workspace chat to show the briefing content. triggerNow awaits ~30-60s; on completion it called loadAll() → chatStore.fetchConversation which overwrote the workspace's currentConversation in the shared store. Fixed with a _mounted flag — all post-async state writes in BriefingView are now guarded so they no-op if the component has been unmounted. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted, watch, nextTick } from 'vue'
|
||||
import { ref, computed, onMounted, onUnmounted, watch, nextTick } from 'vue'
|
||||
import { useBackgroundRefresh } from '@/composables/useBackgroundRefresh'
|
||||
import { useVoiceRecorder } from '@/composables/useVoiceRecorder'
|
||||
import { useVoiceAudio } from '@/composables/useVoiceAudio'
|
||||
@@ -150,10 +150,10 @@ watch(selectedConvId, async (id) => {
|
||||
|
||||
// Refresh messages after streaming ends
|
||||
watch(() => chatStore.streaming, async (streaming) => {
|
||||
if (!streaming && selectedConvId.value === todayConvId.value && todayConvId.value) {
|
||||
if (!streaming && _mounted && selectedConvId.value === todayConvId.value && todayConvId.value) {
|
||||
const today = await getBriefingToday().catch(() => null)
|
||||
if (today) messages.value = today.messages
|
||||
scrollToBottom()
|
||||
if (_mounted && today) messages.value = today.messages
|
||||
if (_mounted) scrollToBottom()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -239,9 +239,10 @@ async function triggerNow() {
|
||||
triggering.value = true
|
||||
try {
|
||||
await triggerBriefingSlot('compilation')
|
||||
await loadAll()
|
||||
// Guard: user may have navigated away during the long compilation
|
||||
if (_mounted) await loadAll()
|
||||
} finally {
|
||||
triggering.value = false
|
||||
if (_mounted) triggering.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,6 +366,9 @@ useBackgroundRefresh(
|
||||
() => !chatStore.streaming && isToday.value && !!todayConvId.value,
|
||||
)
|
||||
|
||||
let _mounted = true
|
||||
onUnmounted(() => { _mounted = false })
|
||||
|
||||
onMounted(async () => {
|
||||
await checkSetup()
|
||||
if (!showWizard.value) await loadAll()
|
||||
|
||||
Reference in New Issue
Block a user