Skip to content

DataViews: user-input filters don't work with fields that use a getValue function #70957

@oandregal

Description

@oandregal

User-input filters, like the ones provided by text or integer by default, need to provide an item-like object to the underlying Edit function they use for the filters.

In pseudo-code, it's something like this:

function InputWidget( {
  filter,
  view,
  onChangeViews,
  fields
} ){

const field = findField( ... );
const filter = findFilter( ... );
const data = {
 [ field.id ] = filter.value, // THE ISSUE
};

return (
  <Edit
    data={data}
    field={field}
    onChange={onChange}
);
}

The issue here is that the data for the field is not necessarily mapped to the field.id, it can live anywhere in the item object — for example, title can come from data.title.raw, that's why we have the getValue function.

We need to have a way to build a data item based on some data (filter values).

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] DataViewsWork surrounding upgrading and evolving views in the site editor and beyond[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions