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

Autogenerate facets as connection where args #31

Open
justlevine opened this issue Jul 23, 2022 · 0 comments · May be fixed by #51
Open

Autogenerate facets as connection where args #31

justlevine opened this issue Jul 23, 2022 · 0 comments · May be fixed by #51
Labels
status: in progress 🚧 Work on this has begun type: feature 🦋 New feature or request
Milestone

Comments

@justlevine
Copy link
Collaborator

What problem does this address?

Currently to use this plugin, you need to manually register_graphql_facet_type(), and then query the facet from RootQuery.
That's a lot of manual work for the user, as well as more verbose queries.

What is your proposed solution?

We should be able to use the existing FacetWP data to autoregister facets to the schema out of the box, ideally as an input on the connections's {Type}ConnectionWhereArgs.

Similarly, facet data can be added to the connection edge.

E.g.

query GetPosts($query: FacetQueryArgs, $after: String, $search: String, $orderBy: [PostObjectsConnectionOrderbyInput]) {
  posts(first: 10, after: $after, where: {status: PUBLISH, search: $search, orderby: $orderBy, facetQuery: $query }) {
    pageInfo {
      hasNextPage
      endCursor
    }
    selectedFacet {
      name
      label
      choices {
        value
        label
        count
      }
    }
    nodes {
      title
      excerpt
    }
  }
}

What alternatives have you considered?

No response

Additional Context

This would be a non-breaking enhancement

@justlevine justlevine added status: confirmed 📍 The issue has been confirmed and reproduced. type: feature 🦋 New feature or request labels Jul 23, 2022
@justlevine justlevine added status: in progress 🚧 Work on this has begun and removed status: confirmed 📍 The issue has been confirmed and reproduced. labels Jan 12, 2023
@justlevine justlevine added this to the v0.5.0 milestone Jan 12, 2023
@justlevine justlevine linked a pull request Jan 18, 2023 that will close this issue
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: in progress 🚧 Work on this has begun type: feature 🦋 New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant