-
Notifications
You must be signed in to change notification settings - Fork 837
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
[EuiDataGrid] Add openCellPopover
and closeCellPopover
to ref APIs
#5550
Merged
cee-chen
merged 13 commits into
elastic:feat/datagrid/5310
from
cee-chen:datagrid/5310/cell-popovers
Jan 26, 2022
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a5bb3b3
[setup] Update testCustomHook to expose fn that allows accessing most…
cee-chen 100e314
Set up cell popover context
cee-chen 048ff1a
Pass down popoverContext to cells as a prop
cee-chen fd25050
Remove internal cell popoverIsOpen state
cee-chen 348d27d
Update cell popovers to set the popover anchor & content
cee-chen ff52079
Refactor EuiDataGridCellPopover
cee-chen 648736d
[bugfix] Handle cells with open popover being scrolled out of view
cee-chen d340172
[bugfix] Workaround for popover DOM stuttering issues
cee-chen 2ebeee1
[enhancement] Account for openCellPopover being called on cells out o…
cee-chen f58e3a5
Update documentation example
cee-chen 7d26739
[PR feedback] Be more specific about useImperativeHandle dependencies
cee-chen 75cf1ad
[PR feedback] Rename openCellLocation to cellLocation
cee-chen f9ed152
[PR feedback] Ignore edge case of `openCellPopover` being called on a…
cee-chen 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 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 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 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
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.
Did you run into this scenario?
Because the
render
function callsisPopoverOpen
, this can trigger the side effect during rendering, which is a strong anti-pattern. If having the popover state set to open when the cell is non-expandable is an issue, we should try to find a different place to account for it.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.
Yes, this scenario can occur if a user manually calls
openCellPopover()
on a cell that they have set toisExpandable: false
. Obviously it wouldn't occur from our internal grid state, but since we're exposing the API to consumers to use at will, I was attempting to guard against it. I tested it locally by addingisExpandable: false
to various columns in theref.js
documentation example.I'm fine removing this piece of logic if you think it's extraneous. The primary bug/scenario I can think of that would occur from not having this logic that sets
popoverIsOpen
back to false is:openCellPopover()
on a cell [0,0] that isisExpandable: false
, internalpopoverIsOpen
state is now set totrue
and cell location is set to[0,0]
isExpandable: true
openCellPopover()
on a cell [0,0] again, but nothing happens becausepopoverIsOpen
state is already set totrue
I admit that's not a likely edge case, so if you strongly think this is a risky change I can remove it 🤷♀️
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 lean toward either 1. moving the
isExpandable
logic intoopenCellPopover
itself, or 2. ignoring the edge case entirely, rather than triggering the side effect from the render.Or, as a third option, maybe even a small check in
componentDidUpdate
.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'm good with just ignoring the edge case entirely! We can say the onus is on the consumer to know if their cells are not expandable and not call
openCellPopover
on cell that shouldn't expandThere 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.
f9ed152
Let's not mark the conversation as resolved BTW, I'd like the dialogue+decision to be immediately visible to anyone who comes back to this PR for historical context.