Skip to content

Conversation

@7MIMIRA
Copy link

@7MIMIRA 7MIMIRA commented Nov 17, 2025

COMPASS-2218

Description

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • If this change could impact the load on the MongoDB cluster, please describe the expected and worst case impact
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

When using Compass I found it slightly frustrating that I couldn't increase the column width in the table view to see the entire _id value.

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

The only UX issue that does not seem to be an easy fix is that when you have enough fields that they butt up against the row actions column, that last field before the pinned row actions column is not resizable. If you swap the column order so it's not agains the row action column you can then resize it though so its inconvenient but not a blocker imo.
See video: https://github.com/user-attachments/assets/4e762afd-a20c-401b-9a6f-8dd191d04d4b

Dependents

N/A

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

Previous implementation would cause the columns to first
render with default widths and then immediately update to
previously set widths whenever the view was refreshed or
when the user switched between tabs
shared state where ColDefs are stored for each tab
@7MIMIRA 7MIMIRA requested a review from a team as a code owner November 17, 2025 10:03
@7MIMIRA 7MIMIRA requested review from Copilot and ivandevp November 17, 2025 10:03
Copy link
Contributor

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

This PR implements resizable column widths in the document table view for Compass, allowing users to adjust column widths to better view their data (such as full _id values). The implementation stores column width preferences in workspace tab state and persists them across interactions.

Key Changes:

  • Added column resize handling to store and restore custom column widths
  • Introduced tableData state object to workspace tabs for tracking column dimensions
  • Connected the grid's resize events to persist width changes in the workspace state

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/compass-workspaces/src/stores/workspaces.ts Initializes tableData with empty columnWidths object for new workspace tabs
packages/compass-workspaces/src/provider.tsx Exports new TableDataObject type and useWorkspaceTabTableData hook
packages/compass-workspaces/src/components/workspace-tab-state-provider.tsx Defines TableDataObject type and creates context provider for table data
packages/compass-workspaces/src/components/workspace-tab-context-provider.tsx Passes tableData prop to WorkspaceTabStateProvider
packages/compass-crud/src/components/table-view/document-table-view.tsx Implements column resize handler and applies stored column widths to grid
packages/compass-crud/src/components/table-view/document-table-view.spec.tsx Adds test coverage for column width persistence functionality
packages/compass-crud/src/components/document-list.tsx Retrieves and passes tableData to the document table view

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@gribnoysup gribnoysup left a comment

Choose a reason for hiding this comment

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

Hey @7MIMIRA, thanks for the contribution. In the current state it doesn't fit Compass structure, I left the comment with some details

Comment on lines 15 to 17
export type TableDataObject = {
columnWidths: Record<string, number>;
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

This breaks the logical separation we're keeping between packages. Workspaces shouldn't know about exact details of the CRUD state. If you need to persist tab state, the useTabState hook is already exposed from the workspaces package. Please move this very specific state from the workspaces plugin to crud as this is the only place where it is relevant. Implementing this functionality shouldn't require you to make any changes to compass-workspaces

@7MIMIRA 7MIMIRA requested a review from gribnoysup November 18, 2025 10:41
@7MIMIRA 7MIMIRA requested a review from Copilot November 19, 2025 04:49
Copy link
Contributor

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@7MIMIRA 7MIMIRA requested a review from gribnoysup November 19, 2025 18:45
Copy link
Collaborator

@gribnoysup gribnoysup left a comment

Choose a reason for hiding this comment

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

Looks good, thanks a ton for the contribution! I'll kick off CI to confirm that tests are passing, if it's all green, this is good to merge

@7MIMIRA
Copy link
Author

7MIMIRA commented Nov 20, 2025

@gribnoysup Great! And you're welcome! Thank you for the code review / guidance.

It looks like a couple checks have failed. Let me know if there's anything I need to do on my end.

@gribnoysup
Copy link
Collaborator

Some usual flakes that we run into some time, nothing related to your changes, otherwise seems pretty green! I'll keep an eye on those and merge when it's ready. It will probably make it into a beta early next week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants