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

fix(subscription): update request return type correctly match apollo-link (v2) #728

Closed
wants to merge 2 commits into from

Conversation

dpilch
Copy link

@dpilch dpilch commented Jul 7, 2022

Description of changes:
Continuing change from #566. This change was originally created by a contributor but it appears to have been abandoned. See #566 for full description.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

See v3 change: #727

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Mark Wolfe and others added 2 commits July 7, 2022 10:04
…link

Current type which doesn't compile.

```
    request(operation: Operation): Observable<unknown>;
```

New type after change which compiles

```
    request(operation: Operation): Observable<FetchResult> | null;
```
@dpilch dpilch requested a review from a team July 7, 2022 16:40
@dpilch dpilch changed the title Observable typev2 fix(subscription): update request return type correctly match apollo-link (v2) Jul 7, 2022
@dpilch
Copy link
Author

dpilch commented Jul 12, 2022

Canceling this change. Please use ApolloLink exported from @apollo/client and there shouldn't be an issue.

import React from "react";
import { registerRootComponent } from "expo";
import Amplify from "aws-amplify";
import AppSyncConfig from "./src/aws-exports";
import { createAuthLink } from "aws-appsync-auth-link";
import { createSubscriptionHandshakeLink } from "aws-appsync-subscription-link";
import {
  ApolloLink,
  ApolloClient,
  ApolloProvider,
  InMemoryCache,
} from "@apollo/client";
import App from "./App";

Amplify.configure(AppSyncConfig);

const url = AppSyncConfig.aws_appsync_graphqlEndpoint;
const region = AppSyncConfig.aws_appsync_region;
const auth = {
  type: AppSyncConfig.aws_appsync_authenticationType,
  apiKey: AppSyncConfig.aws_appsync_apiKey,
};

const link = ApolloLink.from([
  createAuthLink({ url, region, auth }),
  createSubscriptionHandshakeLink({ url, region, auth }),
]);

const client = new ApolloClient({
  link,
  cache: new InMemoryCache(),
});

const WithProvider = () => (
  <ApolloProvider client={client}>
    <App />
  </ApolloProvider>
);

export default registerRootComponent(WithProvider);

@dpilch dpilch closed this Jul 12, 2022
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.

None yet

1 participant