Fix dragging Vue nodes into canvas from library #8118
Conversation
📝 WalkthroughWalkthroughBoth sidebar tab Vue components now capture the current component instance's appContext and propagate it to dynamically created vnodes during drag-preview rendering. This ensures vnodes execute with the correct component context. Changes
Suggested reviewers
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🎨 Storybook Build Status✅ Build completed successfully! ⏰ Completed at: 01/17/2026, 01:00:56 AM UTC 🔗 Links🎉 Your Storybook is ready for review! |
🎭 Playwright Tests:
|
Bundle Size ReportSummary
Category Glance Per-category breakdownApp Entry Points — 3.36 MB (baseline 3.36 MB) • 🔴 +262 BMain entry bundles and manifests
Status: 3 added / 3 removed Graph Workspace — 1.14 MB (baseline 1.14 MB) • ⚪ 0 BGraph editor runtime, canvas, workflow orchestration
Status: 1 added / 1 removed Views & Navigation — 6.66 kB (baseline 6.66 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces
Status: 1 added / 1 removed Panels & Settings — 372 kB (baseline 372 kB) • ⚪ 0 BConfiguration panels, inspectors, and settings screens
Status: 6 added / 6 removed UI Components — 203 kB (baseline 203 kB) • ⚪ 0 BReusable component library chunks
Status: 8 added / 8 removed Data & Services — 12.5 kB (baseline 12.5 kB) • ⚪ 0 BStores, services, APIs, and repositories
Status: 2 added / 2 removed Utilities & Hooks — 1.41 kB (baseline 1.41 kB) • ⚪ 0 BHelpers, composables, and utility bundles
Status: 1 added / 1 removed Vendor & Third-Party — 9.34 MB (baseline 9.34 MB) • ⚪ 0 BExternal libraries and shared vendor chunks
Other — 5.38 MB (baseline 5.38 MB) • ⚪ 0 BBundles that do not match a named category
Status: 16 added / 16 removed |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@src/components/sidebar/tabs/nodeLibrary/NodeBookmarkTreeExplorer.vue`:
- Around line 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.
In `@src/components/sidebar/tabs/NodeLibrarySidebarTab.vue`:
- Around line 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.
| renderDragPreview(container) { | ||
| const vnode = h(NodePreview, { nodeDef: node.data }) | ||
| vnode.appContext = appContext | ||
| render(vnode, container) |
There was a problem hiding this comment.
🧹 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.
| renderDragPreview(container) { | ||
| const vnode = h(NodePreview, { nodeDef: node.data }) | ||
| vnode.appContext = appContext | ||
| render(vnode, container) |
There was a problem hiding this comment.
🧹 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.
## Summary Updates the node preview rendering to use the same app context as the main app so it can access the same plugins ## Changes Assigns manually created vnode app context to the current instances context ## Review Focus This is using somewhat advanced/almost-internal Vue functionality, however I couldn't come up with a better alternative that didn't require recreating an entirely new app and re-registering all dependencies or redoing how draggable node previews are done. The draggable image needs to be rendered synchronously, so rendering a node in the active app and capturing that isn't possible to guarantee to be done synchronously (afaik - suggestions welcome) ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8118-Fix-dragging-Vue-nodes-into-canvas-from-library-2eb6d73d365081a0a956d8280e009592) by [Unito](https://www.unito.io)
|
@pythongosssss Successfully backported to #8346 |
…#8346) 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>
Summary
Updates the node preview rendering to use the same app context as the main app so it can access the same plugins
Changes
Assigns manually created vnode app context to the current instances context
Review Focus
This is using somewhat advanced/almost-internal Vue functionality, however I couldn't come up with a better alternative that didn't require recreating an entirely new app and re-registering all dependencies or redoing how draggable node previews are done.
The draggable image needs to be rendered synchronously, so rendering a node in the active app and capturing that isn't possible to guarantee to be done synchronously (afaik - suggestions welcome)
┆Issue is synchronized with this Notion page by Unito