-
-
Notifications
You must be signed in to change notification settings - Fork 458
Allow multiple columns to be resized together #5075
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
Conversation
| const { apiContext } = this; | ||
| function* getApiRequests() { | ||
| for (const [columnId, displayOptions] of changes.entries()) { | ||
| yield api.columns.metadata.set({ | ||
| ...apiContext, | ||
| column_meta_data_list: [{ attnum: columnId, ...displayOptions }], | ||
| }); | ||
| } | ||
| } | ||
| await batchRun([...getApiRequests()]); |
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.
I'll say this, I like generators, however I find .map(...) more readable for usages like these.
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.
Yeah, that's fair. Thinking back on this code, I think at some point I had been using some more logic inside that function, and then that changed. I don't recall exactly. I agree that in this case array mapping would be cleaner and more readable.
pavish
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.
@seancolsen This works really well!
I added 58ce552 to exit early from columnsDatastore.setDisplayOptions when there are no entries, because batchRun (and batchSend) throw an error when there are no requests. This scenario happens when the user changes the width of a joined column.
The error from batchRun doesn't cause any problem, however, we ought to either remove that error or make the types more strict to avoid any uncaught exceptions.
Fixes #4921
Related
Checklist
Update index.md).developbranch of the repositoryDeveloper Certificate of Origin
Developer Certificate of Origin