PostHog / posthog

🦔 PostHog provides open-source product analytics, session recording, feature flagging and A/B testing that you can self-host.
https://posthog.com
Other
20.38k stars 1.21k forks source link

Switching filter from "doesn't equal" to "doesn't contain" removes existing options. #16716

Open thmsobrmlr opened 1 year ago

thmsobrmlr commented 1 year ago

Is your feature request related to a problem?

Switching filter from "doesn't equal" to "doesn't contain" removes existing options. This is especially annoying on pages like dashboards or settings where the changes get persisted automatically.

Describe the solution you'd like

Local state that one can go back to, once realising that "doesn't contain" will remove the existing options.

Describe alternatives you've considered

Additional context

Reported by customer here https://posthoghelp.zendesk.com/agent/tickets/4478

argshook commented 1 year ago

thanks for submitting as github issue!

Describe alternatives you've considered

  • Allow multiple "doesn't contain" options?

this would be superb! Especially, because i often find myself using matches regex/doesn't match regex instead of contains/doesn't contain when i want to filter by substring. And then the regex can become quite bothersome to edit (specifically by non-technical users)

Arun-chaitanya commented 1 year ago

@thmsobrmlr I think this would be the best solution as it will also add a feature which will be a plus. If you give a green signal, I can start working on this.

Allow multiple "doesn't contain" options?

thmsobrmlr commented 1 year ago

@Arun-chaitanya I agree that this would be the best option and you're welcome to work on it. A work of caution though - there might be a reason why we haven't implemented it in this way in the first place and this might quickly become unwieldy.

It may be best to do some exploratory digging first and see if these changes could be done frontend only or wether we'd need to change the underlying insight queries or run into other complications.

neilkakkar commented 1 year ago

Yep, if you add multiple doesn't contain, you'll have to update every thing on the backend to support this kind of filter, (and disable selecting this on feature flags at minimum, unless you fancy updating all SDKs too 🙈 ).

So, I'd recommend not going this route, atleast not for now, and not for a first contribution

Arun-chaitanya commented 1 year ago

@neilkakkar @thmsobrmlr I get it. Then the alternative simple solution would be:

  1. To persist the string array values in the frontend in the state for doesn't equal in the separate state variable. I will implement that and let you know.
Arun-chaitanya commented 1 year ago

Starting on this today.