When you place a generated asset on the design canvas, flowGen registers a stable per-node media id and broadcasts the update so the same asset can be tracked and refreshed across canvases.
Where: Add to canvas / Paste to Replace from a generation node — Send a result that carries a source node id onto the canvas
Key ideas
- Persistent media id: buildSharedMediaId(sourceNodeId, type) derives a stable id from the originating node, so re-running that node and re-uploading lands on the same storage slot rather than spawning a new orphan asset every time.
- Update broadcast: After a successful Add-to-canvas or Paste-to-Replace that has a source node id, broadcastMediaUpdate(sharedId, assetURL, info) emits a MediaSourceInfo record ({ source:'mediagen', nodeId, mediaType, generatedAt }) describing what changed and when.
- Registered MediaGen context: Each canvas registers itself as a MediaGen context (engineStore.registerMediaGenContext with the conversationId) on mount and unregisters on unmount, so the rest of the app knows a live media-gen source exists for cross-canvas wiring.
Steps
- Generate an asset on a node and use 'Add to canvas' or 'Paste to Replace' — pass-through of the source node id is what enables sync (anonymous one-off pastes don't broadcast).
- On upload, flowGen computes a persistent media id from the node so the asset has a stable storage location across regenerations.
- On success it broadcasts a media-update event carrying the shared id, the new URL, and a MediaSourceInfo stamp (source, node id, media type, timestamp).
- Re-run the same node and place it again: because the media id is stable, the new render reuses the same slot (with a fresh cache-busting query string) instead of creating a duplicate asset.
- Note the canvas auto-registers/unregisters its MediaGen context as you open and leave it — no manual setup is needed for an asset to be recognized as a media-gen source.
FAQ
Why didn't a broadcast fire when I added my asset?
Cross-canvas sync only triggers when the action carries a source node id. Results added or pasted without an originating node id (e.g. ad-hoc URLs) are placed but not broadcast for sync.
Why does the canvas URL have a ?t= timestamp on it?
When uploading under a persistent media id, a cache-busting timestamp is appended so the browser re-fetches the freshly re-rendered asset instead of showing a stale cached version.
Is this fully wired end-to-end?
The send/broadcast and persistent-id side are live from the canvas. Treat the consuming/auto-refresh side as beta — the sharing utility module is partly stubbed in this checkout, so verify the receiving behavior before relying on automatic propagation.