-
Notifications
You must be signed in to change notification settings - Fork 247
feat(compass-crud): enable resizable column widths in document table view COMPASS-2218 #7573
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
base: main
Are you sure you want to change the base?
feat(compass-crud): enable resizable column widths in document table view COMPASS-2218 #7573
Conversation
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
…en projections are used and then removed
There was a problem hiding this 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
tableDatastate 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.
packages/compass-crud/src/components/table-view/document-table-view.tsx
Outdated
Show resolved
Hide resolved
packages/compass-crud/src/components/table-view/document-table-view.spec.tsx
Outdated
Show resolved
Hide resolved
…-view.spec.tsx Co-authored-by: Copilot <[email protected]>
gribnoysup
left a comment
There was a problem hiding this 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
| export type TableDataObject = { | ||
| columnWidths: Record<string, number>; | ||
| }; |
There was a problem hiding this comment.
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
There was a problem hiding this 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.
packages/compass-crud/src/components/table-view/document-table-view.tsx
Outdated
Show resolved
Hide resolved
packages/compass-crud/src/components/table-view/document-table-view.tsx
Outdated
Show resolved
Hide resolved
gribnoysup
left a comment
There was a problem hiding this 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
|
@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. |
|
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 |
COMPASS-2218
Description
Checklist
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.
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