Skip to content

isArray: Property method #59

@GaussianWonder

Description

@GaussianWonder

The current Property class does not implement the isArray method which causes it to always return false.

This results in data type misinterpretation in lists.

It is fixable by manually overriding the type in the resource options, however, it still makes it very hard to implement custom filtering options inside the list action.

What fails for me is the resource.find call which eventually tries to convertFilter.

if (['boolean', 'number', 'float', 'object', 'array'].includes(filter.property.type())) {
  // <- reaching this step when filter.property.isArray() === true will make it easier to write custom filtering options for array properties.
  where[name] = safeParseJSON(filter.value);
}

If all these changes were to be applied, one could simply:

onChange(props.property.path, JSON.stringify(prismaWhereClauseCompatibleWithArrayDataType));

inside custom filter property components.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions