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

Postgraphile V5 - Filtering by nested relations not working when filter value is undefiend #208

Open
scottravio opened this issue Feb 16, 2024 · 0 comments

Comments

@scottravio
Copy link

scottravio commented Feb 16, 2024

Version: 3.0.0-beta.2

When filtering by a related table field, the plugin works when the filter value is defined. When the filter value is undefined the filter plugin seems to filter out rows where the related table row is null.

For example given a query like:

query Query($departmentId: UUID) {
   users(
      filter : {
         jobTitleToDepartment: {
             department: { id: { equalTo: $departmentId }}
         }
      }
   ) {
       nodes {
           id
       }
    }
}

This works as long as the department relation exists. If querying for a user with a job title that does not have a department, no rows are returned when the $departmentId variable is undefined. Expected behaviour is to ignore the filter with the filter value is undefined

The jobTitleToDepartment relation is a virtual constraint created with the @foreignKey smart tag

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