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

chore: ugrade to apollo v3.4 #2331

Merged
merged 1 commit into from
Aug 9, 2021
Merged

chore: ugrade to apollo v3.4 #2331

merged 1 commit into from
Aug 9, 2021

Conversation

emmenko
Copy link
Member

@emmenko emmenko commented Aug 4, 2021

Extracted ugrading changes related to Apollo v3.4 from #2318

This Apollo version seems to be a bit buggy, so we wait a bit to see if some of the issues are resolved.

@vercel
Copy link

vercel bot commented Aug 4, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/commercetools/merchant-center-application-kit/Hc8tvXan4fwQYSWuWJu2Es8TmR9r
✅ Preview: https://merchant-center-application-kit-git-nm-apollo-34-commercetools.vercel.app

@changeset-bot
Copy link

changeset-bot bot commented Aug 4, 2021

🦋 Changeset detected

Latest commit: b8a7c03

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
merchant-center-application-template-starter Patch
@commercetools-frontend/application-shell Patch
@commercetools-frontend/application-shell-connectors Patch
@commercetools-frontend/mc-scripts Patch
playground Patch
@commercetools-frontend/application-components Patch
@commercetools-frontend/permissions Patch
@commercetools-local/visual-testing-app Patch
@commercetools-website/components-playground Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel vercel bot temporarily deployed to Preview August 4, 2021 13:06 Inactive
@@ -159,6 +159,7 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
// Makes some environment variables available to the JS code, for example:
// if (process.env.NODE_ENV === 'development') { ... }.
new webpack.DefinePlugin({
__DEV__: 'true',
Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -27,7 +27,9 @@ export type MenuLoaderResult<Key extends MenuKey> = Key extends 'appBar'
: never;
export type Config<Key extends MenuKey> = {
environment: TApplicationContext<{}>['environment'];
queryOptions?: QueryFunctionOptions;
Copy link
Member Author

Choose a reason for hiding this comment

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

Somehow TS was getting a bit confused, so I decided to be explicit in which query options are being used from our side.

// NOTE: we lazily execute the query to ensure that (for development) we can
// write the data into the cache BEFORE the query attempts to read from it.
// If not, Apollo throws an error like `Can't find field 'applicationMenu' on ROOT_QUERY object`.
const [executeQuery, { data: menuQueryResult, called }] = useMcLazyQuery<
Copy link
Member Author

Choose a reason for hiding this comment

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

This is due to the changes in Apollo v3.4

fetchPolicy: config.environment.servedByProxy
? queryOptions.fetchPolicy || 'cache-first'
Copy link
Member Author

Choose a reason for hiding this comment

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

The queryOptions.fetchPolicy wasn't really used.

Comment on lines +28 to +29
expect(console.error).toHaveBeenCalledWith(
expect.stringContaining(`Missing field 'id'`)
);
Copy link
Member Author

Choose a reason for hiding this comment

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

Apollo now also logs an error

@vercel vercel bot temporarily deployed to Preview August 9, 2021 09:32 Inactive
@emmenko emmenko marked this pull request as ready for review August 9, 2021 09:40
@emmenko emmenko requested a review from pa3 August 9, 2021 09:40
@emmenko
Copy link
Member Author

emmenko commented Aug 9, 2021

Merging, as it's blocking other PR updates.

@emmenko emmenko merged commit 670ec97 into main Aug 9, 2021
@emmenko emmenko deleted the nm-apollo-3.4 branch August 9, 2021 13:58
@ghost ghost mentioned this pull request Aug 9, 2021
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.

1 participant