mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-25 08:49:36 +00:00
fix: suppress link rendering during slot sync after graph reconfigure
After graph reconfiguration (e.g., undo/redo), there's a timing gap where canvas renders links before Vue components have mounted and synced slot positions to layoutStore. This adds a pendingSlotSync flag to layoutStore that: - Is set to true at start of graph.onConfigure() - Is cleared after flushScheduledSlotLayoutSync() completes - Causes drawConnections() to skip link rendering when true This prevents links from rendering with stale/missing positions during the brief window between configure() completing and Vue components syncing. Amp-Thread-ID: https://ampcode.com/threads/T-019c084c-49dd-764b-8125-8938c42612c8 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -31,13 +31,19 @@ function scheduleSlotLayoutSync(nodeId: string) {
|
||||
raf.schedule()
|
||||
}
|
||||
|
||||
function flushScheduledSlotLayoutSync() {
|
||||
if (pendingNodes.size === 0) return
|
||||
export function flushScheduledSlotLayoutSync() {
|
||||
if (pendingNodes.size === 0) {
|
||||
// Even if no pending nodes, clear the flag (e.g., graph with no nodes)
|
||||
layoutStore.setPendingSlotSync(false)
|
||||
return
|
||||
}
|
||||
const conv = useSharedCanvasPositionConversion()
|
||||
for (const nodeId of Array.from(pendingNodes)) {
|
||||
pendingNodes.delete(nodeId)
|
||||
syncNodeSlotLayoutsFromDOM(nodeId, conv)
|
||||
}
|
||||
// Clear the pending sync flag - slots are now synced
|
||||
layoutStore.setPendingSlotSync(false)
|
||||
}
|
||||
|
||||
export function syncNodeSlotLayoutsFromDOM(
|
||||
|
||||
Reference in New Issue
Block a user