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 Filter fails to show compound filters with no default value #5657

Merged
merged 2 commits into from
Dec 11, 2020

Conversation

fzaninotto
Copy link
Member

Closes #5653

@fzaninotto fzaninotto added the RFR Ready For Review label Dec 11, 2020
@@ -246,7 +246,9 @@ const useListParams = ({
...displayedFilterValues,
[filterName]: true,
};
const filter = set(filterValues, filterName, defaultValue);
const filter = defaultValue
Copy link
Member Author

Choose a reason for hiding this comment

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

The problem was with compound filters (e.f. 'comment.title') with no default value. set returned {comment: {}}, which is wrong in that case.

describe('showFilter', () => {
it('should initialize displayed filters', () => {
const TestedComponent = () => {
const [_, { showFilter }] = useListParams({
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need the _, just leave the slot it empty

Suggested change
const [_, { showFilter }] = useListParams({
const [, { showFilter }] = useListParams({


it('should initialize displayed filters on compound filters', () => {
const TestedComponent = () => {
const [_, { showFilter }] = useListParams({
Copy link
Contributor

Choose a reason for hiding this comment

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

Same

Suggested change
const [_, { showFilter }] = useListParams({
const [, { showFilter }] = useListParams({


it('should initialize filters on compound filters', () => {
const TestedComponent = () => {
const [_, { showFilter }] = useListParams({
Copy link
Contributor

Choose a reason for hiding this comment

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

Same

Suggested change
const [_, { showFilter }] = useListParams({
const [, { showFilter }] = useListParams({

@djhi djhi added this to the 3.11 milestone Dec 11, 2020
@djhi djhi merged commit caec5d7 into master Dec 11, 2020
@djhi djhi deleted the Fix-compound-filter-show branch December 11, 2020 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filter with nested source does not work correctly
2 participants