From 4c2edae5a51efd68a307298b4cd47acb8a3162fb Mon Sep 17 00:00:00 2001 From: Comfy Org PR Bot Date: Wed, 28 Jan 2026 10:26:09 +0900 Subject: [PATCH] [backport cloud/1.37] Fix dragging Vue nodes into canvas from library (#8346) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport of #8118 to `cloud/1.37` Automatically created by backport workflow. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8346-backport-cloud-1-37-Fix-dragging-Vue-nodes-into-canvas-from-library-2f66d73d3650816b804ae117a4674d53) by [Unito](https://www.unito.io) Co-authored-by: pythongosssss <125205205+pythongosssss@users.noreply.github.com> --- .../sidebar/tabs/NodeLibrarySidebarTab.vue | 13 ++++++++++++- .../tabs/nodeLibrary/NodeBookmarkTreeExplorer.vue | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/components/sidebar/tabs/NodeLibrarySidebarTab.vue b/src/components/sidebar/tabs/NodeLibrarySidebarTab.vue index 2240a60b1..ef9cf5dd0 100644 --- a/src/components/sidebar/tabs/NodeLibrarySidebarTab.vue +++ b/src/components/sidebar/tabs/NodeLibrarySidebarTab.vue @@ -139,7 +139,15 @@ import { storeToRefs } from 'pinia' import Divider from 'primevue/divider' import Popover from 'primevue/popover' import type { Ref } from 'vue' -import { computed, h, nextTick, onMounted, ref, render } from 'vue' +import { + computed, + getCurrentInstance, + h, + nextTick, + onMounted, + ref, + render +} from 'vue' import SearchBox from '@/components/common/SearchBox.vue' import type { SearchFilter } from '@/components/common/SearchFilterChip.vue' @@ -171,6 +179,8 @@ import type { FuseFilterWithValue } from '@/utils/fuseUtil' import NodeBookmarkTreeExplorer from './nodeLibrary/NodeBookmarkTreeExplorer.vue' +const instance = getCurrentInstance()! +const appContext = instance.appContext const nodeDefStore = useNodeDefStore() const nodeBookmarkStore = useNodeBookmarkStore() const nodeHelpStore = useNodeHelpStore() @@ -272,6 +282,7 @@ const renderedRoot = computed>(() => { draggable: node.leaf, renderDragPreview(container) { const vnode = h(NodePreview, { nodeDef: node.data }) + vnode.appContext = appContext render(vnode, container) return () => { render(null, container) diff --git a/src/components/sidebar/tabs/nodeLibrary/NodeBookmarkTreeExplorer.vue b/src/components/sidebar/tabs/nodeLibrary/NodeBookmarkTreeExplorer.vue index 646f841bb..766641386 100644 --- a/src/components/sidebar/tabs/nodeLibrary/NodeBookmarkTreeExplorer.vue +++ b/src/components/sidebar/tabs/nodeLibrary/NodeBookmarkTreeExplorer.vue @@ -22,7 +22,15 @@