Skip to content

Conversation

herzog31
Copy link
Member

Description

This use case is based one CIF-739. The price listed on the top right corner of the image (attached) needs to be client-side rendered. This is because price could be a personalized product attribute and showing this as client-side rendered in the reference product detail component will provide developers with an example to showcase how server-side rendered content can be enhanced with client-side content.

I added a new function in the CommerceGraphqlApi.js file that allows fetching of prices for one or multiple products. The same function can also be used for CIF-804.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes and the overall coverage did not decrease.
  • All unit tests pass on CircleCi.
  • I ran all tests locally and they pass.

@codecov-io
Copy link

codecov-io commented Jun 24, 2019

Codecov Report

Merging #62 into master will increase coverage by 0.33%.
The diff coverage is 92.3%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #62      +/-   ##
============================================
+ Coverage     62.32%   62.65%   +0.33%     
  Complexity      166      166              
============================================
  Files            26       26              
  Lines           937      948      +11     
  Branches         64       64              
============================================
+ Hits            584      594      +10     
- Misses          324      325       +1     
  Partials         29       29
Flag Coverage Δ Complexity Δ
#karma 94.92% <92.3%> (-0.24%) 0 <0> (ø)
#unittests 54.19% <ø> (ø) 166 <ø> (ø) ⬇️
Impacted Files Coverage Δ Complexity Δ
...ommerce/product/v1/product/clientlib/js/product.js 94.11% <92.3%> (-1.54%) 0 <0> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d75e4b...cfdb2e8. Read the comment docs.

};

let response = await this._fetch(this.endpoint, params);
if (response.errors) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember @cjelger saying something about the response.errors not being the best way to check for errors since a response can contain both errors and data.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I refactored the code here into a separate function and didn't change existing functionality. I'll take care of that in a follow up PR :)

@herzog31 herzog31 merged commit 23248bf into master Jun 26, 2019
@herzog31 herzog31 deleted the issue/CIF-743 branch June 26, 2019 11:19
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

Successfully merging this pull request may close these issues.

3 participants