Skip to content

Graph Panel widget: improve graph panel resizing and visibility handling#475

Closed
agarny wants to merge 5 commits intoopencor:mainfrom
agarny:issue473
Closed

Graph Panel widget: improve graph panel resizing and visibility handling#475
agarny wants to merge 5 commits intoopencor:mainfrom
agarny:issue473

Conversation

@agarny
Copy link
Contributor

@agarny agarny commented Mar 24, 2026

Fixes #473.

Copilot AI review requested due to automatic review settings March 24, 2026 20:44
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 isVisible handling from GraphPanelWidget and drive alignment via resize() after Plotly.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.

Comment on lines +744 to 745
// Force Plotly to recalculate the layout after each react() call to keep the graph aligned with sibling panels.

Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
// 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;
}

Copilot uses AI. Check for mistakes.
@agarny agarny closed this Mar 25, 2026
@agarny agarny deleted the issue473 branch March 25, 2026 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Graph Panel widget: improve graph panel resizing and visibility handling

2 participants