-
Notifications
You must be signed in to change notification settings - Fork 13
Fix/filters disappearing bug #71
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
|
This pull request introduces 1 alert when merging 6ca5f08 into 29a968f - view on LGTM.com new alerts:
|
|
It seems this PR will show zeroes for all options, but I think our logic could be smarter: can we only show those zeroes for those selected options? |
|
This pull request introduces 1 alert when merging 0cffdf1 into 29a968f - view on LGTM.com new alerts:
|
|
This pull request introduces 2 alerts when merging 32c8b36 into 29a968f - view on LGTM.com new alerts:
|
|
This pull request introduces 2 alerts when merging 61c8516 into 29a968f - view on LGTM.com new alerts:
|
| export const updateCountsInInitialTabsOptions = ( | ||
| initialTabsOptions, processedTabsOptions, filtersApplied, | ||
| ) => { | ||
| const updatedTabsOptions = JSON.parse(JSON.stringify(initialTabsOptions)); |
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 do we need to stringify and then parse this object here? 🤔
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.
alright it took me time to understand this code block but I guess you were trying to deep clone an object here. :D
| filterConfig={this.props.filterConfig} | ||
| onFilterChange={e => this.handleFilterChange(e)} | ||
| hideZero={this.props.hideZero} | ||
| hideZero={this.props.hideZeroCountFilterOptions} |
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.
Is the reason why we change the name hideZero to hideZeroCountFilterOptions because of backward compatibility here?
| receivedAggsData: {}, | ||
| accessibility: ENUM_ACCESSIBILITY.ALL, | ||
| adminAppliedPreFilters: Object.assign({}, this.props.adminAppliedPreFilters), | ||
| filter: Object.assign({}, this.props.adminAppliedPreFilters), |
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 seems this this.state.filter is not useful anymore, could we just remove this, and so that not having both filter and filtersApplied, you might also want to remove its only reference in componentDidMount function
| if (isFilterOptionToBeHidden( | ||
| updatedTabsOptions[fieldName].histogram[k], filtersApplied, fieldName, | ||
| )) { | ||
| updatedTabsOptions[fieldName].histogram.splice(k, 1); |
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.
Wow I finally understand this 3-level loop 👍 I think this works! except the readability, and if there's a way to use JS's built -in Array filter or map function to reduce the level of nested loops that would be great. But anyway I am fine with keeping this. Could you add a break here? I know this if statement should only satisfy once in this for loop but just in case...
qingyashu
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.
This is awesome and thanks for the fixing! Looks good to me so I just approved it. Is it possible that we deploy and test it somewhere?
qingyashu
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.
sorry just checked the filterSelf feature doesn't work as before, going to hold this PR for a while for the fixing
…lters-disappearing-bug
|
sorry about false alarm... the problem i mentioned is not a bug but a feature. Will approve this. |
qingyashu
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.
awesome!~
deployed in https://zakir.planx-pla.net/explorer
demonstration of case 1 (unchecked zero):
demonstration of case 2 (checked zero):
Improvements