Skip to content

FilterControl: `values` doesn't need a `FilteredConnectionFilterValue`

Warren Gifford requested to merge aharvey/default-filter-values into main

Created by: LawnGnome

The label and arguments that are otherwise included in FilteredConnectionFilterValue are unnecessary in values, since we only need the actual value to set the selected attributes appropriately. This saves some boilerplate when using filters with ConnectionForm.

This is a change I'm making in #40238 as part of moving the executor site admin page away from RxJS (and adding a bunch of new features), but I want to get a review on this separately because I can't help but feel like I'm missing something about the design of this. Basically, the difference here is that without this PR, you have to do something like this:

                <ConnectionForm
                    filters={filters}
                    values={new Map([['state', {value: state, args: [], label: "ignored"}]])}
                />

And with it, you can do this, with no functional difference:

                <ConnectionForm
                    filters={filters}
                    values={new Map([['state', state]])}
                />

(Which is still a bit wordy, since you have to instantiate a Map and all, but could be worse.)

Test plan

There are no users of this right now, but this will be implicitly tested once #40238 lands.

App preview:

Check out the client app preview documentation to learn more.

Merge request reports

Loading