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

offlineLink + stateLink and split socket wont work together #9

Closed
agborkowski opened this issue Apr 4, 2018 · 1 comment
Closed

Comments

@agborkowski
Copy link

	const httpLinks = middlewareLink.concat(
			afterwareLink.concat(httpLink)
		);

		const link = split(
			({ query }) => {
				const { kind, operation } = getMainDefinition(query);
				return kind === 'OperationDefinition' && operation === 'subscription';
			},
			webSocketLink,
			httpLinks

		);

		const loggerLink = new ApolloLink((operation, forward) => {
			console.log(`loggerLink: ${operation.operationName}`);
			return forward(operation).map((result) => {
				console.log(`received result from loggerLink: ${operation.operationName}`);
				return result;
			});
		});

		const cache = new InMemoryCache();

		// const stateLink = withClientState({ ...merge(networkStatusResolver), cache });
		const stateLink = withClientState({
			cache,
			resolvers,
			defaults: {
				show_type: 'BELOW_15'
			}
		});

		const ApolloClient = apollo.create({
			cache,
			link: ApolloLink.from([
				stateLink,
				new RetryLink(),
				offlineLink, //Type 'QueueLink' is not assignable to type 'ApolloLink'.
				link /*loggerLink*/, /*stateLink*/
				
			]),
```
@agborkowski
Copy link
Author

ok i fiexd it, bad type i assign...

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

No branches or pull requests

1 participant