-
Notifications
You must be signed in to change notification settings - Fork 860
[EuiDataGrid] Fix row height tests and mocks #6050
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
Merged
weltenwort
merged 8 commits into
elastic:main
from
weltenwort:data-grid-fix-row-height-tests
Jul 19, 2022
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d6091a3
Fix row height tests and mocks
weltenwort 24f6bce
Restore accidentally removed test case
weltenwort 75b8e28
Update src/components/datagrid/utils/row_heights.test.ts
weltenwort 9efe690
Merge branch 'main' into data-grid-fix-row-height-tests
weltenwort 6c2c170
Clean up forceRender usage and RowHeightUtils instantiation
weltenwort fd36097
Deduplicate grid API type
weltenwort c6ac32b
Comment and test the useLatest hook
weltenwort b5c152b
Fix typo in comment
weltenwort File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
[super optional] if you wanted to leave these required props inline, you could also set
rowHeightUtilsafterwards on line 60 by doingThat is a relatively minor preference on my part to reduce test file setup cruft as much as possible (or as much as isn't actually relevant to what we're testing - and in this file row heights aren't really being tested).
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.
If that's the style you prefer, I can change it. I'd recommend to treat values immutably as often as possible, though. It usually reduces cognitive load on the reader and allows for more compiler checks and JIT optimizations.
Uh oh!
There was an error while loading. Please reload this page.
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.
Super interesting!! (I love code discussions like this BTW, so you'll have to forgive me for overindulging π)
TIL π I had thought that instantiating fewer consts/vars vs. just 1 obj would be 'better' in terms of optimization. Compiler checks makes sense though. I know we're splitting hairs at this point though in terms of microperf, but definitely food for me to think about!
I definitely acknowledge this is very subjective, but my personal 2c is that more cruft/setup at the top of the file is harder for me to read / more cognitive load than otherwise. I prefer to jump straight into the core purpose/logic of the file when possible to try and grasp its intentions. When I come across a var I'll tend to store it in my short-term memory assuming it'll be re-used later and I'll want to try and connect the var definition/reference to where it's being used, so more vars = more things flying around my head to try and remember. So for the test files if I start by seeing a single
const requiredProps = ...declaration, I get a sense of "oh these are just the props needed to get the test started", and I'll collapse that obj or skim/skip past it, whereas if I see other vars defined I'll be like "this seems important/will come into play later, I'll try to remember it individually".Like I said, very much subjective though, forgive my rambling! My comment definitely was optional/not a change request so if you prefer it this way, feel free to leave it