dynatrace-oss / barista

Barista - the Dynatrace design system. Tailored to scale.
https://barista.dynatrace.com
Apache License 2.0
143 stars 78 forks source link

[Filter field] Distinct option does not work #1547

Closed seilmsteiner closed 4 years ago

seilmsteiner commented 4 years ago

Bug Report

The distinct option on the filter field does not work if the selected filter value is no longer in the autocomplete list. Then it is still possible to add another filter of this category.

Expected Behavior

If the distinct option is applied, the filter field should not allow another filter of this category in any situation.

Current Behavior

It is possible to apply to filters of the same category, although distinct=true is set.

Possible Solution

Only a workaround: add the applied filters always to the suggestion list

Steps to Reproduce

Context (Environment)

In Memory Profiling:

rowa-audil commented 4 years ago

@seilmsteiner

So in that case you would need to drop the previous TYPE filters for the updated one? Or do you need the filtered tag from the old TYPE after you updated too?

rowa-audil commented 4 years ago

Investigation results:

The actual behavior should be like that. The distinct option does not apply to 'multiple changing' data sources but to one. The definition of distinct concerns one autocomplete or data source.

In @seilmsteiner's case, the problem is a bit different since it concerns a changing data source. Short summary: Pick the first filter e.g: TYPE: 'string' (out of string, number) then the second e.g: API: 'anything' which results in the available TYPE filter options to change e.g: TYPE has only 'number' as an option now

Now the issue is that it should be distinct but since the distinct option doesn't concern changing data sources, the user can pick TYPE with new options again

IMO this issue is a feature request.

What is your opinion on that? @thomaspink @tomheller @lukasholzer

rowa-audil commented 4 years ago

Closing this issue as it is not a bug nor a feature request.

rowa-audil commented 4 years ago

Through the investigation the following this came up:

Investigation results:

The actual behavior should be like that. The distinct option does not apply to 'multiple changing' data sources but to one. The definition of distinct concerns one autocomplete or data source.

In @seilmsteiner's case, the problem is a bit different since it concerns a changing data source. Short summary: Pick the first filter e.g: TYPE: 'string' (out of string, number) then the second e.g: API: 'anything' which results in the available TYPE filter options to change e.g: TYPE has only 'number' as an option now

Now the issue is that it should be distinct but since the distinct option doesn't concern changing data sources, the user can pick TYPE with new options again

Why is this issue closed?:

As it turns out the filter field component doesn't support multiple datasources, since the probability of remembering old data causing memory leaks is too high. @seilmsteiner's issue is a special use-case for his project in a very specific manner and we can not handle such specific use-cases on our side. Possible workaround would be: Datasources should not be reassigned but next()'ed, so the distinct option applies as it doesn't distinguish between multiple reassigned datasources.