-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fix(column-configurator): convert to using the taxonomic filter #8726
Conversation
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.
Looking at this funnel less than 50% of people who open the column customizer choose a new column and then click save The hypothesis would be that this change would mean it was over 50% So the tradeoff of losing global filtering over the columns is worthwhile |
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.
Please downscale this PR and leave just the essentials. My main feedback:
- There's no need for the popover at all. You can't interact with it and it just looks odd. Plus having it makes the code more complicated than it needs to be (all that new prop passing indirection and useEffect confusion). Let's also try to avoid passing the
style
prop. - The height of the left list is less than the right one
- The title "Selected columns" is also misleading.
Small PRs. MVPs. Keep things simple. Don't add things just in case. Etc. :)
This is kind of old, but I put together a version of this a while ago that would scale to various viewport sizes. https://www.figma.com/file/9yWtngNb1AIuf6KmXaEPJA/App-doodles?node-id=1512%3A146391 |
… fill its parent container
@mariusandra it wasn't, no... CSS fighting me :) I'll check the reset button |
Very much not the scope of this PR 🤣 But also a small change to make it leave the modal open. So 🤷 In your gif with the double time column. You have time as a selected column in the modal. and the table always adds time on the end of the selected columns. I'm not sure which of those is a bug... But that's the behaviour in master so it's not introduced in this PR... Since this started as a 6 character PR have logged this here #8861 |
…earch query when an item is selected
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.
Still to do
@@ -268,6 +268,7 @@ export function InfiniteList(): JSX.Element { | |||
totalResultCount, | |||
totalListCount, | |||
expandedCount, | |||
showPopper, |
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.
Perhaps popper
-> popover
?
"Popper" is just the name of the library, but "popover" (or "popup"?) is what we want to show.
@@ -56,7 +58,7 @@ export function InfiniteSelectResults({ | |||
return ( | |||
<BindLogic | |||
logic={infiniteListLogic} | |||
props={{ ...taxonomicFilterLogicProps, listGroupType: taxonomicGroupTypes[0] }} | |||
props={{ ...taxonomicFilterLogicProps, listGroupType: taxonomicGroupTypes[0], popperEnabled }} |
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.
Why can't this popperEnabled
just be inside taxonomicFilterLogicProps
? I mean... it already is there...?
const style = {} | ||
if (height) { | ||
style['height'] = `${height}px` | ||
} | ||
if (width) { | ||
style['width'] = `${width}px` | ||
} |
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 the unit is pixels, with width
and height
you can just pass a number, and px
will be added automatically. Also using flexible destructuring could make it a bit easier to read... maybe:
const style = {
...(width ? { width } : {}),
...(height ? { height } : {}),
}
@@ -14,6 +15,7 @@ describe('the taxonomic property filter', () => { | |||
|
|||
beforeEach(() => { | |||
initKeaTests() | |||
columnConfiguratorLogic({ selectedColumns: [] }).mount() |
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.
Hmm... Will this test fail without it? If so, it's coupled in a strange way. Something to improve?
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.
it's too yucky, I'll remove
index: [ | ||
0 as number, | ||
(props.popperEnabled === false ? -1 : 0) as 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.
Actually... this doesn't make sense: "If you disable the popup we unselect the first item.". This is a side-effect of popperEnabled
that's really not obvious. Would a separate prop like selectFirstItem = false
make more sense?
it('clears the search query when the column configurator saves', async () => { | ||
await expectLogic(logic, () => { | ||
logic.actions.setSearchQuery('tomato') | ||
columnConfiguratorLogic.actions.save() | ||
}).toMatchValues({ | ||
searchQuery: '', | ||
}) | ||
}) |
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.
Wouldn't this fit better into a column configurator test? This taxonomic filter should be totally oblivious to where it's being used from.
@@ -49,6 +50,7 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>({ | |||
groupPropertiesModel, | |||
['allGroupProperties'], | |||
], | |||
actions: [columnConfiguratorLogic, ['save']], |
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.
Oohh... no, this won't do. It's like a textfield has a dependency on a settings page. It should be the other way around.
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, I've been sat chewing this over. There are some frustrating consequences of taxonomic filter being inside the column configurator that I don't seem to be able to squash
searchQuery: [ | ||
'', | ||
{ | ||
setSearchQuery: (_, { searchQuery }) => searchQuery, | ||
selectItem: () => '', | ||
selectItem: (state) => (props.clearSearchOnSelection === false ? state : ''), |
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.
Reducers should technically be pure functions. That means the same state
+ payload
combo should always return the same value. Here we don't know if props
has changed in between. Won't block for it, just remarking on the code smell :).
} | ||
|
||
export type TaxonomicFilterValue = string | number | ||
|
||
export interface TaxonomicFilterLogicProps extends TaxonomicFilterProps { | ||
taxonomicFilterLogicKey: string | ||
clearSearchOnSelection?: boolean |
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.
The interface this extends already contains this.
c338d0e
to
3504c00
Compare
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 think you've worked enough on this 😅
Changes
Loading the column configurator shows 0 available columns despite there being properties available
I can't reproduce this locally but am assuming that property definitions isn't triggering change detection because we're updating the same array instance not copying it
This change copies the array
related to #8257
How did you test this code?
By pushing to CI :/