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

clarify seemingly redundant collection resolver logic #2195

Open
batzlerg opened this issue Jan 9, 2024 · 0 comments
Open

clarify seemingly redundant collection resolver logic #2195

batzlerg opened this issue Jan 9, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@batzlerg
Copy link
Contributor

batzlerg commented Jan 9, 2024

Describe the feature you'd like
I would appreciate a clarification on what edge case the following logic is covering:

: {
title: root.Title,
description: root.MetaTagDescription,
},

and potentially a code change to simplify that logic in that resolver if the edge case is unreachable.

  1. the isBrand(root) || isCollectionPageType(root) condition seems redundant, because pageType: "Brand" is already of type CollectionPage
  2. currently, TS intellisense hints that the false branch of the ternary is only reachable when the "collection" entity being resolved is a category in the store taxonomy, and likely an N-level category because L0,L1,L2 categories get their own pageType designation. this is depicted in the screenshot below. however, the observed root shape for all levels of category in the actual API response is always the lowercase set of keys.
Screen Shot 2024-01-09 at 2 41 02 PM

I know certain VTEX APIs return the PascalCase keys rather than the camelCase keys, so I'm curious if it's something specific to our store's configuration or API version that's making that more deterministic, or if this edge case handling is now archaic and can be removed.

Describe alternatives you've considered
we're overriding this logic in our own custom resolver, and having to replicate manually because the types are not exported. it would be helpful to understand if the core edge case that this handling was written for is truly deprecated so that we can at least remove it in our own override if not also simplify in the /api package.

@batzlerg batzlerg added the enhancement New feature or request label Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant