Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Table Input Resizing #12643

Merged
merged 12 commits into from
Mar 28, 2025
Merged

Conversation

farmaazon
Copy link
Contributor

Pull Request Description

Fixes #12520

Screencast.From.2025-03-26.11-47-19.mp4

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.
  • [ ] If meaningful changes were made to logic or tests affecting Enso Cloud integration in the libraries,
    or the Snowflake database integration, a run of the Extra Tests has been scheduled.
    • If applicable, it is suggested to paste a link to a successful run of the Extra Tests.

@farmaazon farmaazon added the -gui label Mar 26, 2025
@farmaazon farmaazon self-assigned this Mar 26, 2025
Copy link

github-actions bot commented Mar 26, 2025

🧪 Storybook is successfully deployed!

📊 Dashboard:

Comment on lines 28 to 29
if (!initialBounds) break
bounds.value = initialBounds.withBoundsClamped(
selectFields(resizing, {
top: initialBounds.top + pos.relative.y,
bottom: initialBounds.bottom + pos.relative.y,
left: initialBounds.left + pos.relative.x,
right: initialBounds.right + pos.relative.x,
}),
)
else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be simplified to if (initialBounds)

Comment on lines 266 to 275
const scale = computed(() => navigator?.scale ?? 1)
provideResizableWidgetRegistry(
computed({
get: () => visualizationWidth.value && visualizationWidth.value * scale.value,
set: (width) => (visualizationWidth.value = width && width / scale.value),
}),
() => CONTENT_PADDING * scale.value,
() => widgetTreeSize.value.x,
)

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this may cause a performance problem in large graphs--adding a reactive dependency on navigator.scale will require Vue to update every GraphNode every frame while zooming the graph. Wouldn't it be more efficient for the registry to use scene coordinates?

Copy link
Contributor Author

@farmaazon farmaazon Mar 27, 2025

Choose a reason for hiding this comment

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

GraphNode components should not be updated; nodeWidth change in resizableWidgetRegistry will trigger a watch calling adjustToNodeWidth, but here we would just compute exactly the same widget size, which is discarded before writing to metadata.

And because I rely on useResizeObserver, the code would be launched anyway on zoom in/out. The optimized solution would require a completely different solution. I assume what is so far is enough - but I test it with 100 nodes yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tested it on 100 Table.input nodes. It's laggy, but same way as on develop. Interestingly, AgGrid is refreshed there when zooming - probably worth checking at some point.

@farmaazon farmaazon requested a review from kazcw March 27, 2025 15:59
@farmaazon farmaazon added the CI: Ready to merge This PR is eligible for automatic merge label Mar 28, 2025
@mergify mergify bot merged commit 350d1e0 into develop Mar 28, 2025
60 checks passed
@mergify mergify bot deleted the wip/farmaazon/fix-table-input-resizing branch March 28, 2025 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-gui CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resizing Table.input via Viz width doesn't resize input grid
2 participants