{"action":"opened","issue":{"url":"https://api.github.com/repos/sammkj/mantra-redux/issues/3","repository_url":"https://api.github.com/repos/sammkj/mantra-redux","labels_url":"https://api.github.com/repos/sammkj/mantra-redux/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/sammkj/mantra-redux/issues/3/comments","events_url":"https://api.github.com/repos/sammkj/mantra-redux/issues/3/events","html_url":"https://github.com/sammkj/mantra-redux/issues/3","id":163031677,"number":3,"title":"apollo client on infinite loop when used with mantra-redux","user":{"login":"purplecones","id":136654,"avatar_url":"https://avatars.githubusercontent.com/u/136654?v=3","gravatar_id":"","url":"https://api.github.com/users/purplecones","html_url":"https://github.com/purplecones","followers_url":"https://api.github.com/users/purplecones/followers","following_url":"https://api.github.com/users/purplecones/following{/other_user}","gists_url":"https://api.github.com/users/purplecones/gists{/gist_id}","starred_url":"https://api.github.com/users/purplecones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/purplecones/subscriptions","organizations_url":"https://api.github.com/users/purplecones/orgs","repos_url":"https://api.github.com/users/purplecones/repos","events_url":"https://api.github.com/users/purplecones/events{/privacy}","received_events_url":"https://api.github.com/users/purplecones/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-06-29T21:32:02Z","updated_at":"2016-06-29T21:32:02Z","closed_at":null,"body":"When I use this package to include apollo client, it goes into an infiintae loop\r\n```javascript\r\nconst Client = configureGraphQLClient();\r\nconst logger = createLogger();\r\nconst middlewares = [\r\n  thunk,\r\n  logger,\r\n  Client.middleware(),\r\n];\r\n\r\nconst reducers = {\r\n  // other reducers\r\n  apollo: Client.reducer(),\r\n};\r\n\r\nconst context = initContext({ Client });\r\nconst app = createApp(context);\r\napp.loadMiddlewares([\r\n  redux({\r\n    reducers,\r\n    middlewares,\r\n  }),\r\n]);\r\napp.loadModule(coreModule);\r\n// load more modules\r\napp.init();\r\n```\r\n\r\nExample Container:\r\n```javascript\r\nconst mapQueryToProps = ({ context }, onData) => {\r\n  const { Client } = context();\r\n\r\n  const query = `{\r\n    investmentAccounts {\r\n      userId\r\n      streetAddress1\r\n    }\r\n  }`;\r\n\r\n  const taggedQuery = gql`${query}`;\r\n\r\n  Client.query({\r\n    query: taggedQuery,\r\n    forceFetch: true,\r\n  }).then((graphQLResult) => {\r\n    onData(null, {\r\n      data: graphQLResult.data,\r\n      errors: graphQLResult.errors,\r\n    });\r\n  }).catch((ex) => {\r\n    onData(ex);\r\n  });\r\n};\r\n```\r\nResult\r\n![mantra-redux-1](https://cloud.githubusercontent.com/assets/136654/16469358/8946b950-3e1e-11e6-8787-9e0acc32e41d.gif)\r\n\r\nHowever, If I use the mantra-apollo package instead, it is fine\r\n```javascript\r\napp.loadMiddlewares([\r\n  redux({\r\n    reducers,\r\n    middlewares,\r\n  }),\r\n  apollo({\r\n    clientName: 'Client',\r\n  }),\r\n]);\r\n```\r\n![mantra-redux-2](https://cloud.githubusercontent.com/assets/136654/16469431/e64225e0-3e1e-11e6-8003-7a0efb01cb9a.gif)\r\n\r\nNot too familiar with the internals of apollo client yet, but it appears to be an issue with [mantra-redux](https://github.com/sammkj/mantra-redux) when using the apollo middleware. I'd prefer to use it that way so that there is one store instead of two with the example directly above."}}
{"actor":{"display_login":"purplecones"}}