fix: combine repeated chart exports into single image#492
fix: combine repeated chart exports into single image#492ObservedObserver wants to merge 1 commit intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| return item.view.toCanvas(2); | ||
| })); | ||
| return canvases.map(canvas => canvas.toDataURL('image/png', 1)); | ||
| const merged = concatCanvases(canvases, viewsRef.current); |
There was a problem hiding this comment.
Bug: Stale ref used after async canvas generation
In getCanvasData() and downloadPNG(), viewsRef.current is read once before the async Promise.all() to generate canvases, then read again after the await to pass to concatCanvases. If viewsRef.current changes during the async operation (e.g., due to re-render), the canvases array and refs array could have different lengths or orderings, causing concatCanvases to access undefined ref elements and throw a TypeError when accessing ref.x or ref.y.
Summary
Testing
Codex Task
Note
Combine multiple Vega chart canvases into one merged PNG for data-url and download exports, propagating the merged data across chart entries.
concatCanvasesto stitch multiple chartcanvaselements into a grid based onIVegaChartRef(x,y), computing column widths, row heights, and offsets.useVegaExportApi):getCanvasData/downloadPNG: generate a single merged PNG viaconcatCanvases; return/download one image instead of per-chart files.exportChart(modedata-url): assign the merged imagedatato allres.chartsentries; SVG export remains unchanged.Written by Cursor Bugbot for commit 75ea542. Configure here.