decaporg / decaporg/decap-cms

Collection filters should check truthy-ness when no value set.

Open
#1,000 8 comments 4 reactions 0 assignees View on GitHub
area: configuration kind: enhancement pinned status: accepted
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

**- Do you want to request a *feature* or report a *bug*?**
bug

**- What is the current behavior?**
Currently, if a filter is set on a collection, without setting a value:
```yaml
filter: {field: "contact"}
```
The CMS will only show files which do *not* contain this field.

**- If the current behavior is a bug, please provide the steps to reproduce.**

**- What is the expected behavior?**
In my opinion, this is counter-intuitive, and instead should check whether the field *does* exist. If no value is set, the CMS should show any file which contains the field, regardless of the value. For required fields, they always exist so this wouldn't matter, but for optional fields it does.

If people wanted to use the old behavior (checking for non-existent fields), I believe they would be able to set `value: undefined`.

**- Please mention your CMS, node.js, and operating system version.**

v1.0.3+master

**- Please link or paste your `config.yml` below if applicable.**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.