{"id":22220523,"url":"https://github.com/drawbotics/react-apollo-redux","last_synced_at":"2025-10-25T00:33:38.479Z","repository":{"id":85908830,"uuid":"112360746","full_name":"Drawbotics/react-apollo-redux","owner":"Drawbotics","description":"A small wrapper to automatically dispatch actions in response to apollo mutations.","archived":false,"fork":false,"pushed_at":"2018-02-06T16:28:59.000Z","size":80,"stargazers_count":57,"open_issues_count":0,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-16T10:36:41.950Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Drawbotics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-11-28T16:32:15.000Z","updated_at":"2023-04-03T12:31:17.000Z","dependencies_parsed_at":"2023-06-07T21:45:45.836Z","dependency_job_id":null,"html_url":"https://github.com/Drawbotics/react-apollo-redux","commit_stats":{"total_commits":19,"total_committers":2,"mean_commits":9.5,"dds":0.4736842105263158,"last_synced_commit":"bf63dfe095bc37a1a5c95fc0bfb664872075cd3d"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Drawbotics%2Freact-apollo-redux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Drawbotics%2Freact-apollo-redux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Drawbotics%2Freact-apollo-redux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Drawbotics%2Freact-apollo-redux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Drawbotics","download_url":"https://codeload.github.com/Drawbotics/react-apollo-redux/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227817177,"owners_count":17824199,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-02T23:08:58.373Z","updated_at":"2025-10-25T00:33:38.406Z","avatar_url":"https://github.com/Drawbotics.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://raw.githubusercontent.com/Drawbotics/react-apollo-redux/master/images/react-apollo-redux.png\" height=\"150px\"\u003e\n\n# React Apollo Redux\n\n[![NPM](https://nodei.co/npm/react-apollo-redux.png?compact=true)](https://www.npmjs.com/package/react-apollo-redux)\n\n[![npm version](https://img.shields.io/npm/v/react-apollo-redux.svg?style=flat-square)](https://www.npmjs.com/package/react-apollo-redux)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](LICENSE)\n\nThis library wraps the `graphql` function from [react-apollo](https://github.com/apollographql/react-apollo) function by also dispatching redux actions when a mutation is called.\n\nIf you were using\n```js\nimport { graphql } from 'react-apollo';\n```\nyou may now do\n```js\nimport { graphql } from 'react-apollo-redux';\n```\n\n### Usage\n\nWhen a mutation is called, an action bearing the same name (snake and upper cased) and prefixed with `@@MUTATION` is dispatched. For example, a mutation like this\n```js\nconst FollowItems = gql`\n  mutation followItems($itemIds: [ID]!) {\n    followItems(item_ids: $itemIds) {\n      id,\n    },\n  }\n`;\n\n\ngraphql(FollowItems, {\n  name: 'followItems',\n}),\n```\nWill dispatch the following actions with respective types:\n\n#### type @@MUTATION/FOLLOW_ITEMS\n`@@MUTATION/[name]` contains the arguments to the mutation in its payload. For example, if the mutation was called this way\n```js\nfollowItems({\n  variables: {\n    itemIds: itemIds,\n  },\n  extra: {\n    user,\n    references,\n  },\n});\n```\nThe payload will contain that object.\n\n#### type @@MUTATION/FOLLOW_ITEMS_SUCCESS\n`@@MUTATION/[name]_SUCCESS` is dispatched once the mutation result is successfully returned from the server. The action payload contains two things:\n- The `result` from the server (as specified in the mutation)\n- The arguments (`args`) passed to the mutation, like above\n\n\n#### type @@MUTATION/FOLLOW_ITEMS_FAIL\n`@@MUTATION/[name]_FAIL` is dispatched if the server returns an error. This action contains the same payload as the initial action `@@MUTATION/FOLLOW_ITEMS`, and has an additional `meta` property with the error returned from the server.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrawbotics%2Freact-apollo-redux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrawbotics%2Freact-apollo-redux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrawbotics%2Freact-apollo-redux/lists"}