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

Upgrade ApolloClient package to version 3 #424

Merged
merged 11 commits into from
Oct 28, 2020
Merged

Upgrade ApolloClient package to version 3 #424

merged 11 commits into from
Oct 28, 2020

Conversation

laurentiumagureanu
Copy link
Collaborator

@laurentiumagureanu laurentiumagureanu commented Oct 19, 2020

Description

Removed @magento/peregrine dependency
Upgraded Apollo client to version 3

Related Issue

CIF-1633

Motivation and Context

Apollo GraphQL client version 3 is required for the GET requests

How Has This Been Tested?

Unit tests

Screenshots (if appropriate):

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
Copy link

codecov bot commented Oct 19, 2020

Codecov Report

Merging #424 into master will increase coverage by 0.20%.
The diff coverage is 45.45%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #424      +/-   ##
============================================
+ Coverage     84.96%   85.17%   +0.20%     
  Complexity     1054     1054              
============================================
  Files           216      219       +3     
  Lines          5428     5416      -12     
  Branches        781      780       -1     
============================================
+ Hits           4612     4613       +1     
+ Misses          664      651      -13     
  Partials        152      152              
Flag Coverage Δ Complexity Δ
#integration 67.03% <ø> (ø) 762.00 <ø> (ø)
#jest 79.74% <45.45%> (+0.52%) 0.00 <0.00> (ø)
#karma 93.64% <ø> (ø) 0.00 <ø> (ø)
#unittests 85.76% <ø> (ø) 1015.00 <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
...src/components/AccountDetails/useAccountDetails.js 94.59% <ø> (ø) 0.00 <0.00> (ø)
...nents/src/components/AddressForm/useAddressForm.js 100.00% <ø> (ø) 0.00 <0.00> (ø)
react-components/src/components/App/app.js 20.00% <0.00%> (+4.61%) 0.00 <0.00> (ø)
...nents/BundleProductOptions/bundleProductOptions.js 95.89% <ø> (ø) 0.00 <0.00> (ø)
...ts/src/components/ChangePassword/changePassword.js 100.00% <ø> (ø) 0.00 <0.00> (ø)
...components/src/components/Checkout/editableForm.js 46.15% <ø> (ø) 0.00 <0.00> (ø)
.../components/Checkout/paymentProviders/braintree.js 82.97% <ø> (ø) 0.00 <0.00> (ø)
...eact-components/src/components/Checkout/useCart.js 100.00% <ø> (ø) 0.00 <0.00> (ø)
...-components/src/components/Checkout/useOverview.js 62.06% <ø> (ø) 0.00 <0.00> (ø)
...s/src/components/CreateAccount/useCreateAccount.js 100.00% <ø> (ø) 0.00 <0.00> (ø)
... and 17 more

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 61461fa...c1364c8. Read the comment docs.


const emptyCartId = 'empty';
const mockCartId = '123ABC';
const mockShippingAddress = {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should improve this mechanism a bit, like have these mocks "collected" at runtime from a file structure instead of just piling them into this file.

});
}
});
const client = new ApolloClient(clientConfig);
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this client supposed to come from the custom application?

Copy link
Member

Choose a reason for hiding this comment

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

I assume, if a customer uses their own ApolloClient, they wouldn't use CommerceApp anymore, but add their own ApolloProvider together with a mix of their own and our contexts.

Copy link
Contributor

Choose a reason for hiding this comment

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

But this defies the purpose of the CommerceApp. As soon as they want to have a custom component that wants to fetch data they have to refactor all their code to drop CommerceApp and re-create our provider stack.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can modify CommerceApp to receive the client as a prop. if that prop is not provided, then a default client will be created.

@laurentiumagureanu laurentiumagureanu changed the title Enable clients to use their own ApolloClient instance Upgrade ApolloClient package to version 3 Oct 26, 2020
@alkim91 alkim91 merged commit 500aa34 into master Oct 28, 2020
@alkim91 alkim91 deleted the issues/CIF-1633 branch October 28, 2020 08:18
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.

4 participants