Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isArray: Property method #59

Open
GaussianWonder opened this issue Oct 3, 2024 · 0 comments
Open

isArray: Property method #59

GaussianWonder opened this issue Oct 3, 2024 · 0 comments

Comments

@GaussianWonder
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant