Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/components/sidebar/tabs/NodeLibrarySidebarTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -272,6 +282,7 @@ const renderedRoot = computed<TreeExplorerNode<ComfyNodeDefImpl>>(() => {
draggable: node.leaf,
renderDragPreview(container) {
const vnode = h(NodePreview, { nodeDef: node.data })
vnode.appContext = appContext
render(vnode, container)
Comment on lines 283 to 286
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

App-context propagation looks correct; centralize the internal hook.

Given vnode.appContext is internal, consider a shared helper to reduce risk if Vue changes internals later.

🤖 Prompt for AI Agents
In `@src/components/sidebar/tabs/NodeLibrarySidebarTab.vue` around lines 283 -
286, The code sets vnode.appContext directly in renderDragPreview (using
renderDragPreview, NodePreview, vnode.appContext, appContext, render) which
relies on an internal Vue hook; create a small shared helper (e.g.,
setVNodeAppContextAndRender or renderVNodeWithAppContext) that encapsulates
assigning appContext to the vnode and calling render, then replace the inline
assignment in renderDragPreview with that helper to centralize the internal-hook
use and make future changes easier to update in one place.

return () => {
render(null, container)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@
</template>

<script setup lang="ts">
import { computed, h, nextTick, ref, render, watch } from 'vue'
import {
computed,
getCurrentInstance,
h,
nextTick,
ref,
render,
watch
} from 'vue'
import { useI18n } from 'vue-i18n'

import FolderCustomizationDialog from '@/components/common/CustomizationDialog.vue'
Expand All @@ -41,6 +49,8 @@ import type {
TreeNode
} from '@/types/treeExplorerTypes'

const instance = getCurrentInstance()!
const appContext = instance.appContext
const props = defineProps<{
filteredNodeDefs: ComfyNodeDefImpl[]
openNodeHelp: (nodeDef: ComfyNodeDefImpl) => void
Expand Down Expand Up @@ -154,6 +164,7 @@ const renderedBookmarkedRoot = computed<TreeExplorerNode<ComfyNodeDefImpl>>(
},
renderDragPreview(container) {
const vnode = h(NodePreview, { nodeDef: node.data })
vnode.appContext = appContext
render(vnode, container)
Comment on lines 165 to 168
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Consider encapsulating internal vnode.appContext usage.

This is the right fix, but vnode.appContext is internal; a tiny helper (or short comment) would centralize this dependency for future Vue upgrades.

🤖 Prompt for AI Agents
In `@src/components/sidebar/tabs/nodeLibrary/NodeBookmarkTreeExplorer.vue` around
lines 165 - 168, The code directly assigns the internal vnode.appContext inside
renderDragPreview (creating a vnode from NodePreview then setting
vnode.appContext before calling render), so extract that into a small helper
(e.g., setVNodeAppContext or attachAppContextToVNode) and call it from
renderDragPreview, or at minimum add a single-line comment referencing why
vnode.appContext is required and that it centralizes the internal API usage for
future Vue upgrades; update references in renderDragPreview to use the new
helper and keep the NodePreview, appContext and render usage unchanged.

return () => {
render(null, container)
Expand Down
Loading