fix: should only trigger asset panel when it opening (#7098)

## Summary

fix https://github.com/Comfy-Org/ComfyUI_frontend/issues/7097

## Screenshots

<!-- Add screenshots or video recording to help explain your changes -->
before
<img width="2085" height="452" alt="image"
src="https://github.com/user-attachments/assets/437f85f0-103f-422a-ba07-2e4e43f763d4"
/>

after
<img width="1208" height="265" alt="image"
src="https://github.com/user-attachments/assets/bcb246ee-d963-4c74-9e0b-8d02266cc6ac"
/>

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-7098-fix-should-only-trigger-asset-panel-when-it-opening-2bd6d73d36508118a8a6e7db994da775)
by [Unito](https://www.unito.io)
This commit is contained in:
Terry Jia
2025-12-02 13:44:53 -05:00
committed by GitHub
parent 49824824e6
commit 573cda853b

View File

@@ -206,19 +206,25 @@ const init = () => {
}
const queuePendingTaskCountStore = useQueuePendingTaskCountStore()
const sidebarTabStore = useSidebarTabStore()
const onStatus = async (e: CustomEvent<StatusWsMessageStatus>) => {
queuePendingTaskCountStore.update(e)
await Promise.all([
queueStore.update(),
assetsStore.updateHistory() // Update history assets when status changes
])
await queueStore.update()
// Only update assets if the assets sidebar is currently open
// When sidebar is closed, AssetsSidebarTab.vue will refresh on mount
if (sidebarTabStore.activeSidebarTabId === 'assets') {
await assetsStore.updateHistory()
}
}
const onExecutionSuccess = async () => {
await Promise.all([
queueStore.update(),
assetsStore.updateHistory() // Update history assets on execution success
])
await queueStore.update()
// Only update assets if the assets sidebar is currently open
// When sidebar is closed, AssetsSidebarTab.vue will refresh on mount
if (sidebarTabStore.activeSidebarTabId === 'assets') {
await assetsStore.updateHistory()
}
}
const reconnectingMessage: ToastMessageOptions = {