Skip to content

Commit

Permalink
[visual-editor] Teach visual editor to create runtime-resolvable refe…
Browse files Browse the repository at this point in the history
…rences.

- **When creating a reference, convert it to an
`UnresolvedPathBoardCapability`**
- **docs(changeset): Teach visual editor to create runtime-resolvable
references.**
  • Loading branch information
dglazkov authored Dec 18, 2024
1 parent 1c4e7fb commit 707a440
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/cuddly-toys-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@breadboard-ai/visual-editor": patch
---

Teach visual editor to create runtime-resolvable references.
9 changes: 9 additions & 0 deletions packages/visual-editor/src/runtime/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,15 @@ export class Edit extends EventTarget {
graphId = "";
}

if (typeof value === "string") {
// Convert to `UnresolvedPathBoardCapability`, so that it is resolved
// at runtime.
// This is important for ensuring that relative URLs are resolved
// relative to where they are invoked from, rather than to where they
// are used.
value = { kind: "board", path: value };
}

const node = editableGraph.inspect(graphId).nodeById(nodeId);
const port = node
?.currentPorts()
Expand Down

0 comments on commit 707a440

Please sign in to comment.