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

Create Query.primaryShop GraphQL resolver #4727

Closed
aldeed opened this issue Oct 12, 2018 · 2 comments
Closed

Create Query.primaryShop GraphQL resolver #4727

aldeed opened this issue Oct 12, 2018 · 2 comments
Assignees

Comments

@aldeed
Copy link
Contributor

aldeed commented Oct 12, 2018

We have Query.primaryShopId and Query.shopById. A client currently needs two requests to those to get the primary shop data, which is the most common case and happens all the time on first load. We can simplify this for client development by creating Query.primaryShop, which combines those two lookups on the server (and reduces to a single DB query).

@ticean
Copy link
Member

ticean commented Oct 12, 2018

Hi @aldeed,

  1. How do we know which primary shop is desired if there's more than one shop? The existing primaryShopID query doesn't have input parameters. How would this query work in a multi-shop/multi-site setup, where shops are siblings? Ex: shop1.com & shop2.com?
  • Which GraphQL client would use this in our current starterkit configuration - the browser or the SSR application?
    • Is the response data required to get the rest of the page in most cases? One request is better than two but it's not great to have a blocking request for bootstrap info.
    • Can we leverage SSR to fetch the info on the server side and bootstrap the application with static data sent in the page on first request?
    • The SSR could also inspect the request (domain, path, etc) to determine which shop is desired based on routing rules. That data would be highly cacheable.

@spencern
Copy link
Contributor

@ticean
The way that our current marketplace/multi-shop setup works is that each installation must have exactly one primary shop. There can be any number of other shops, but only one primary shop. I believe this is currently hard-coded to the first shop that is created, though I'm not certain about this.

We can discuss how we'd like improve this but I believe this issue is mostly about creating a helper query that simplifies the lookup of that primary shop (which is the only shop in a single shop installation)

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

4 participants