Graph Panel widget: improve graph panel resizing and visibility handling#475
Graph Panel widget: improve graph panel resizing and visibility handling#475agarny wants to merge 5 commits intoopencor:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Improves the Graph Panel widget’s resize/margin behavior (Issue #473) by removing the initial visibility gating and adding safer measurement logic, while also updating TypeScript/tooling configuration and dependency versions.
Changes:
- Remove
isVisiblehandling fromGraphPanelWidgetand drive alignment viaresize()afterPlotly.react(). - Add a “measurable size” guard before asynchronously computing/emitting margins.
- Update TypeScript/tooling configs and bump TypeScript/@vue/tsconfig versions (plus lockfile updates).
Reviewed changes
Copilot reviewed 7 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/renderer/src/components/widgets/GraphPanelWidget.vue |
Removes visibility toggling; adds measurable-size guard; resizes after each Plotly react to keep alignment correct. |
tsconfig.app.json |
Changes emit/declaration settings (now conflicts with allowImportingTsExtensions). |
tsconfig.json |
Enables composite + declaration + emit at solution level. |
tsconfig.node.json |
Enables Node project emit settings. |
tsconfig.web.json |
Enables Web project emit settings and sets NodeNext module options. |
src/renderer/tsconfig.json |
Adds emitDeclarationOnly setting (currently ineffective with noEmit: true). |
package.json |
Bumps version and devDependencies (notably TypeScript). |
src/renderer/package.json |
Bumps renderer package version and devDependencies. |
bun.lock / src/renderer/bun.lock |
Lockfile updates for the dependency bumps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Force Plotly to recalculate the layout after each react() call to keep the graph aligned with sibling panels. | ||
|
|
There was a problem hiding this comment.
updatePlot() now unconditionally calls resize() after every Plotly.react(). When the widget is mounted but has 0x0 size (e.g., hidden panel/tab), this can trigger unnecessary Plotly resize work. Consider guarding the call (e.g., check mainDivRef dimensions before resizing) so resizes only happen once the container can actually be measured.
| // Force Plotly to recalculate the layout after each react() call to keep the graph aligned with sibling panels. | |
| // Force Plotly to recalculate the layout after each react() call to keep the graph aligned with sibling panels. | |
| // Only resize when the main container has measurable (non-zero) dimensions to avoid unnecessary work when hidden. | |
| const mainDivEl = mainDivRef.value as HTMLElement | null; | |
| if (!mainDivEl) { | |
| return; | |
| } | |
| const rect = mainDivEl.getBoundingClientRect(); | |
| if (rect.width === 0 || rect.height === 0) { | |
| return; | |
| } |
Fixes #473.