Skip to content
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

Merged
merged 38 commits into from
Mar 7, 2022

Conversation

pauldambra
Copy link
Member

@pauldambra pauldambra commented Feb 23, 2022

Changes

Loading the column configurator shows 0 available columns despite there being properties available

prop-def

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 :/

Copy link
Collaborator

@mariusandra mariusandra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure this won't solve things. We just don't have the properties loaded. The right answer is to make this async, without requiring a download of 100MB of JSON.

2022-02-23 10 52 22

@pauldambra
Copy link
Member Author

## on a wide screen

2022-02-24 09 48 19

## on narrower screens

2022-02-24 09 57 08


maintains behaviour for pop-ups in existing contexts but changes them to close on mouse leave and changes default position to left so that the selected columns in the configurator are more visible

@pauldambra pauldambra changed the title Copy array in selector to trigger change detection Convert the column configurator to use taxonomic filter Feb 24, 2022
@pauldambra
Copy link
Member Author

pauldambra commented Feb 27, 2022

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

@pauldambra pauldambra requested a review from clarkus February 27, 2022 08:38
Copy link
Collaborator

@mariusandra mariusandra left a 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.

2022-03-01 10 35 01

Small PRs. MVPs. Keep things simple. Don't add things just in case. Etc. :)

@clarkus
Copy link
Contributor

clarkus commented Mar 1, 2022

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

Screen Shot 2022-03-01 at 7 50 39 AM

@mariusandra
Copy link
Collaborator

Not sure if this was ready for a review (please always re-tag), but had a quick poke anyway. The reset button is acting funky:

2022-03-03 09 45 19

@pauldambra
Copy link
Member Author

Not sure if this was ready for a review (please always re-tag),

@mariusandra it wasn't, no... CSS fighting me :)

I'll check the reset button

@pauldambra pauldambra changed the title Convert the column configurator to use taxonomic filter fix(column-configurator): convert to using the taxonomic filter Mar 3, 2022
@pauldambra
Copy link
Member Author

pauldambra commented Mar 4, 2022

The reset button still does not work. I also find it strange that it closes the modal directly, instead of resetting the state and letting me choose what columns I want to show.

Very much not the scope of this PR 🤣

But also a small change to make it leave the modal open. So 🤷

2022-03-04 11 27 24

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

@pauldambra
Copy link
Member Author

2022-03-04 14 34 58

@pauldambra pauldambra requested a review from mariusandra March 4, 2022 14:42
Copy link
Collaborator

@mariusandra mariusandra left a 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,
Copy link
Collaborator

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 }}
Copy link
Collaborator

@mariusandra mariusandra Mar 4, 2022

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...?

Comment on lines 56 to 62
const style = {}
if (height) {
style['height'] = `${height}px`
}
if (width) {
style['width'] = `${width}px`
}
Copy link
Collaborator

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()
Copy link
Collaborator

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?

Copy link
Member Author

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,
Copy link
Collaborator

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?

Comment on lines 79 to 86
it('clears the search query when the column configurator saves', async () => {
await expectLogic(logic, () => {
logic.actions.setSearchQuery('tomato')
columnConfiguratorLogic.actions.save()
}).toMatchValues({
searchQuery: '',
})
})
Copy link
Collaborator

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']],
Copy link
Collaborator

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.

Copy link
Member Author

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 : ''),
Copy link
Collaborator

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
Copy link
Collaborator

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.

@pauldambra pauldambra requested a review from mariusandra March 7, 2022 08:47
@pauldambra
Copy link
Member Author

2022-03-07 08 39 26

Copy link
Collaborator

@mariusandra mariusandra left a 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 😅

@mariusandra mariusandra merged commit 717beeb into master Mar 7, 2022
@mariusandra mariusandra deleted the empty-columns branch March 7, 2022 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants