-
Notifications
You must be signed in to change notification settings - Fork 63
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
feat(api): Handle channel as facet for search and product queries #1197
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 5c5529f:
|
c6ae613
to
ccd0ee9
Compare
|
||
export const Query = { | ||
product: async (_: unknown, { locator }: QueryProductArgs, ctx: Context) => { | ||
// Insert channel in context for later usage | ||
ctx.storage = { | ||
...ctx.storage, | ||
channel: | ||
locator.find((facet) => facet.key === 'channel')?.value ?? | ||
ctx.storage.channel, | ||
// TODO: Check if make sense move this parse a layer down or pass the whole parsed channel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just keep it like a string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, you mean that should maintain as a string here and move the parse to be done inside a lower layer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep like a string breaks some internal field resolvers take a look at the
https://sfj-a1d5edd--base.preview.vtex.app/office/
ERROR
Error: Product with id 2791588 has no sellers for channel
{"regionId":"v2.1BB18CE648B5111D0933734ED83EC783","salesChannel":"1"}.
at Object.offers
(webpack://base.store/./node_modules/@faststore/api/dist/api.esm.js?:820:13)
at Object.field.resolve [as StoreProductoffersResolver]
(webpack://base.store/./node_modules/@envelop/core/index.js?:86:32)
at nodeStoreProductEdgenodeResolverHandler (eval at compileQuery
(webpack://base.store/./node_modules/graphql-jit/dist/execution.js?), <anonymous>:3012:39)
at StoreProductConnection__fieldedgesMapItemHandler.__value.then.__context.nullErrors.push._
_context.GraphQLError.line (eval at compileQuery
(webpack://base.store/./node_modules/graphql-jit/dist/execution.js?), <anonymous>:3151:9)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5) {
locations: [ { line: 32, column: 11 } ],
path: [ 'search', 'products', 'edges', 0, 'node', 'offers' ]
}
1b1243b
to
447a842
Compare
Desconsider problems with ci/test frompull request |
What's the purpose of this pull request?
How it works?
How to test it?
base.store
Deploy Previewvtex-sites/base.store#428
References