Giter VIP home page Giter VIP logo

Comments (4)

smolinari avatar smolinari commented on May 26, 2024 1

@Pero122 - We have discussions open, so please ask questions there and just link to this discussion here please, if you need the reference (and in the future). Thanks.

To answer your questions, it's a function exported from Apollo Client. https://github.com/apollographql/apollo-client/blob/92fa8ffd18f4698b98b279613d4f2ddc8b294465/src/link/core/ApolloLink.ts#L84

import { concat } from '@apollo/client'

Scott

from app-extension-apollo.

magersoft avatar magersoft commented on May 26, 2024

Ooops! Just needed

apolloClientConfigObj.link = ApolloLink.from([errorLink, concat(authMiddleware, combinedLinks)]);

from app-extension-apollo.

Pero122 avatar Pero122 commented on May 26, 2024

What is the "concat" method? I can't find it in the documentation

from app-extension-apollo.

Pero122 avatar Pero122 commented on May 26, 2024

I just want to say one more thing, regarding the original posted code for future reference.

The problem with the original code is this part.

  apolloClientConfigObj = {
    ...apolloClientConfigObj,
    link: ApolloLink.from([errorLink, concat(authMiddleware, combinedLinks)])
  };

That is the problem because objects are passed as reference, so instead of changing the original object (we want this so the modified object can be send when constructing apollo client) we are actually creating a new object and modifying the new object instead of the original config object (in this case this is bad, and we don't want this, because the object that will be send is not changing).

So just replace

  apolloClientConfigObj = {
    ...apolloClientConfigObj,
    link: ApolloLink.from([errorLink, concat(authMiddleware, combinedLinks)])
  };

With
apolloClientConfigObj.link = ApolloLink.from([errorLink, concat(authMiddleware, combinedLinks)])

from app-extension-apollo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.