Repository: reduxjs/react-redux
Pull request #945 (2018-05-05 03:54:56)

Remove subkey
This pr removed `subKey` option from `createProvider`.

The `subKey` isn't really useful because `connect` components doesn't know the custom subscription key.
And according to discussion #944 , removing the `subKey` makes things simpler.

- Remove subkey
- Add tests to `Provider`


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 79cc939..1085a74 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,1 +1,1 @@
-All notable changes are described on the [Releases](https://github.com/reactjs/react-redux/releases) page.
+All notable changes are described on the [Releases](https://github.com/reduxjs/react-redux/releases) page.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 4f18569..0c6d19a 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,14 +1,14 @@
 # Contributing
-We are open to, and grateful for, any contributions made by the community.  By contributing to React Redux, you agree to abide by the [code of conduct](https://github.com/reactjs/react-redux/blob/master/CODE_OF_CONDUCT.md).
+We are open to, and grateful for, any contributions made by the community.  By contributing to React Redux, you agree to abide by the [code of conduct](https://github.com/reduxjs/react-redux/blob/master/CODE_OF_CONDUCT.md).
 
 ## Reporting Issues and Asking Questions
-Before opening an issue, please search the [issue tracker](https://github.com/reactjs/react-redux/issues) to make sure your issue hasn't already been reported.
+Before opening an issue, please search the [issue tracker](https://github.com/reduxjs/react-redux/issues) to make sure your issue hasn't already been reported.
 
 Please ask any general and implementation specific questions on [Stack Overflow with a Redux tag](http://stackoverflow.com/questions/tagged/redux?sort=votes&pageSize=50) for support.
 
 ## Development
 
-Visit the [Issue tracker](https://github.com/reactjs/react-redux/issues) to find a list of open issues that need attention.
+Visit the [Issue tracker](https://github.com/reduxjs/react-redux/issues) to find a list of open issues that need attention.
 
 Fork, then clone the repo:
 ```
@@ -56,7 +56,7 @@ Please open an issue with a proposal for a new feature or refactoring before sta
 
 ## Submitting Changes
 
-* Open a new issue in the [Issue tracker](https://github.com/reactjs/react-redux/issues).
+* Open a new issue in the [Issue tracker](https://github.com/reduxjs/react-redux/issues).
 * Fork the repo.
 * Create a new feature branch based off the `master` branch.
 * Make sure all tests pass and there are no linting errors.
diff --git a/README.md b/README.md
index 84404e8..7eec7e5 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,12 @@
 React Redux
 =========================
 
-Official React bindings for [Redux](https://github.com/reactjs/redux).  
+Official React bindings for [Redux](https://github.com/reduxjs/redux).  
 Performant and flexible.
 
-[![build status](https://img.shields.io/travis/reactjs/react-redux/master.svg?style=flat-square)](https://travis-ci.org/reactjs/react-redux) [![npm version](https://img.shields.io/npm/v/react-redux.svg?style=flat-square)](https://www.npmjs.com/package/react-redux)
+[![build status](https://img.shields.io/travis/reduxjs/react-redux/master.svg?style=flat-square)](https://travis-ci.org/reduxjs/react-redux) [![npm version](https://img.shields.io/npm/v/react-redux.svg?style=flat-square)](https://www.npmjs.com/package/react-redux)
 [![npm downloads](https://img.shields.io/npm/dm/react-redux.svg?style=flat-square)](https://www.npmjs.com/package/react-redux)
-[![redux channel on slack](https://img.shields.io/badge/slack-redux@reactiflux-61DAFB.svg?style=flat-square)](http://www.reactiflux.com)
+[![redux channel on discord](https://img.shields.io/badge/discord-redux@reactiflux-61DAFB.svg?style=flat-square)](http://www.reactiflux.com)
 
 
 ## Installation
@@ -25,7 +25,7 @@ If you don’t yet use [npm](http://npmjs.com/) or a modern module bundler, and
 
 As of React Native 0.18, React Redux 5.x should work with React Native. If you have any issues with React Redux 5.x on React Native, run `npm ls react` and make sure you don’t have a duplicate React installation in your `node_modules`. We recommend that you use `npm@3.x` which is better at avoiding these kinds of issues.
 
-If you are on an older version of React Native, you’ll need to keep using [React Redux 3.x branch and documentation](https://github.com/reactjs/react-redux/tree/v3.1.0) because of [this problem](https://github.com/facebook/react-native/issues/2985).
+If you are on an older version of React Native, you’ll need to keep using [React Redux 3.x branch and documentation](https://github.com/reduxjs/react-redux/tree/v3.1.0) because of [this problem](https://github.com/facebook/react-native/issues/2985).
 
 ## Documentation
 
diff --git a/docs/api.md b/docs/api.md
index 93c231b..e4524bf 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -56,9 +56,9 @@ It does not modify the component class passed to it; instead, it *returns* a new
 
   If your `mapStateToProps` function is declared as taking two parameters, it will be called with the store state as the first parameter and the props passed to the connected component as the second parameter, and will also be re-invoked whenever the connected component receives new props as determined by shallow equality comparisons.  (The second parameter is normally referred to as `ownProps` by convention.)
 
-  >Note: in advanced scenarios where you need more control over the rendering performance, `mapStateToProps()` can also return a function. In this case, *that* function will be used as `mapStateToProps()` for a particular component instance. This allows you to do per-instance memoization. You can refer to [#279](https://github.com/reactjs/react-redux/pull/279) and the tests it adds for more details. Most apps never need this.
+  >Note: in advanced scenarios where you need more control over the rendering performance, `mapStateToProps()` can also return a function. In this case, *that* function will be used as `mapStateToProps()` for a particular component instance. This allows you to do per-instance memoization. You can refer to [#279](https://github.com/reduxjs/react-redux/pull/279) and the tests it adds for more details. Most apps never need this.
 
-  >The `mapStateToProps` function's first argument is the entire Redux store’s state and it returns an object to be passed as props. It is often called a **selector**. Use [reselect](https://github.com/reactjs/reselect) to efficiently compose selectors and [compute derived data](https://redux.js.org/recipes/computing-derived-data).
+  >The `mapStateToProps` function's first argument is the entire Redux store’s state and it returns an object to be passed as props. It is often called a **selector**. Use [reselect](https://github.com/reduxjs/reselect) to efficiently compose selectors and [compute derived data](https://redux.js.org/recipes/computing-derived-data).
 
 * [`mapDispatchToProps(dispatch, [ownProps]): dispatchProps`] \(*Object* or *Function*): If an object is passed, each function inside it is assumed to be a Redux action creator. An object with the same function names, but with every action creator wrapped into a `dispatch` call so they may be invoked directly, will be merged into the component’s props.  
 
@@ -68,7 +68,7 @@ It does not modify the component class passed to it; instead, it *returns* a new
 
   If you do not supply your own `mapDispatchToProps` function or object full of action creators, the default `mapDispatchToProps` implementation just injects `dispatch` into your component’s props.
 
-  >Note: in advanced scenarios where you need more control over the rendering performance, `mapDispatchToProps()` can also return a function. In this case, *that* function will be used as `mapDispatchToProps()` for a particular component instance. This allows you to do per-instance memoization. You can refer to [#279](https://github.com/reactjs/react-redux/pull/279) and the tests it adds for more details. Most apps never need this.
+  >Note: in advanced scenarios where you need more control over the rendering performance, `mapDispatchToProps()` can also return a function. In this case, *that* function will be used as `mapDispatchToProps()` for a particular component instance. This allows you to do per-instance memoization. You can refer to [#279](https://github.com/reduxjs/react-redux/pull/279) and the tests it adds for more details. Most apps never need this.
 
 * [`mergeProps(stateProps, dispatchProps, ownProps): props`] \(*Function*): If specified, it is passed the result of `mapStateToProps()`, `mapDispatchToProps()`, and the parent `props`. The plain object you return from it will be passed as props to the wrapped component. You may specify this function to select a slice of the state based on props, or to bind action creators to a particular variable from props. If you omit it, `Object.assign({}, ownProps, stateProps, dispatchProps)` is used by default.
 
diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md
index 4a62a85..17b643f 100644
--- a/docs/troubleshooting.md
+++ b/docs/troubleshooting.md
@@ -17,7 +17,7 @@ In short,
 
 ### My views aren’t updating on route change with React Router 0.13
 
-If you’re using React Router 0.13, you might [bump into this problem](https://github.com/reactjs/react-redux/issues/43). The solution is simple: whenever you use `<RouteHandler>` or the `Handler` provided by `Router.run`, pass the router state to it.
+If you’re using React Router 0.13, you might [bump into this problem](https://github.com/reduxjs/react-redux/issues/43). The solution is simple: whenever you use `<RouteHandler>` or the `Handler` provided by `Router.run`, pass the router state to it.
 
 Root view:
 
diff --git a/package.json b/package.json
index e5fd16a..40db75d 100644
--- a/package.json
+++ b/package.json
@@ -2,8 +2,30 @@
   "name": "react-redux",
   "version": "5.0.7",
   "description": "Official React bindings for Redux",
+  "keywords": [
+    "react",
+    "reactjs",
+    "hot",
+    "reload",
+    "hmr",
+    "live",
+    "edit",
+    "flux",
+    "redux"
+  ],
+  "license": "MIT",
+  "author": "Dan Abramov <dan.abramov@me.com> (https://github.com/gaearon)",
+  "homepage": "https://github.com/reduxjs/react-redux",
+  "repository": "github:reduxjs/react-redux",
+  "bugs": "https://github.com/reduxjs/react-redux/issues",
   "main": "./lib/index.js",
   "module": "es/index.js",
+  "files": [
+    "dist",
+    "lib",
+    "src",
+    "es"
+  ],
   "scripts": {
     "build:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib",
     "build:es": "cross-env BABEL_ENV=es babel src --out-dir es",
@@ -16,33 +38,6 @@
     "test": "jest",
     "coverage": "codecov"
   },
-  "repository": {
-    "type": "git",
-    "url": "https://github.com/reactjs/react-redux.git"
-  },
-  "files": [
-    "dist",
-    "lib",
-    "src",
-    "es"
-  ],
-  "keywords": [
-    "react",
-    "reactjs",
-    "hot",
-    "reload",
-    "hmr",
-    "live",
-    "edit",
-    "flux",
-    "redux"
-  ],
-  "author": "Dan Abramov <dan.abramov@me.com> (https://github.com/gaearon)",
-  "license": "MIT",
-  "bugs": {
-    "url": "https://github.com/reactjs/react-redux/issues"
-  },
-  "homepage": "https://github.com/reactjs/react-redux",
   "peerDependencies": {
     "react": "^0.14.0 || ^15.0.0-0 || ^16.0.0-0",
     "redux": "^2.0.0 || ^3.0.0 || ^4.0.0-0"
diff --git a/src/components/Provider.js b/src/components/Provider.js
index ac77a00..f78e25e 100644
--- a/src/components/Provider.js
+++ b/src/components/Provider.js
@@ -14,13 +14,13 @@ function warnAboutReceivingStore() {
     '<Provider> does not support changing `store` on the fly. ' +
     'It is most likely that you see this error because you updated to ' +
     'Redux 2.x and React Redux 2.x which no longer hot reload reducers ' +
-    'automatically. See https://github.com/reactjs/react-redux/releases/' +
+    'automatically. See https://github.com/reduxjs/react-redux/releases/' +
     'tag/v2.0.0 for the migration instructions.'
   )
 }
 
-export function createProvider(storeKey = 'store', subKey) {
-    const subscriptionKey = subKey || `${storeKey}Subscription`
+export function createProvider(storeKey = 'store') {
+    const subscriptionKey = `${storeKey}Subscription`
 
     class Provider extends Component {
         getChildContext() {
diff --git a/src/connect/selectorFactory.js b/src/connect/selectorFactory.js
index 4479431..de34b33 100644
--- a/src/connect/selectorFactory.js
+++ b/src/connect/selectorFactory.js
@@ -1,5 +1,5 @@
 import verifySubselectors from './verifySubselectors'
-  
+
 export function impureFinalPropsSelectorFactory(
   mapStateToProps,
   mapDispatchToProps,
@@ -64,7 +64,7 @@ export function pureFinalPropsSelectorFactory(
     const nextStateProps = mapStateToProps(state, ownProps)
     const statePropsChanged = !areStatePropsEqual(nextStateProps, stateProps)
     stateProps = nextStateProps
-    
+
     if (statePropsChanged)
       mergedProps = mergeProps(stateProps, dispatchProps, ownProps)
 


Test patch:
diff --git a/test/components/Provider.spec.js b/test/components/Provider.spec.js
index 449cdf0..6830b8f 100644
--- a/test/components/Provider.spec.js
+++ b/test/components/Provider.spec.js
@@ -123,7 +123,7 @@ describe('React', () => {
         '<Provider> does not support changing `store` on the fly. ' +
         'It is most likely that you see this error because you updated to ' +
         'Redux 2.x and React Redux 2.x which no longer hot reload reducers ' +
-        'automatically. See https://github.com/reactjs/react-redux/releases/' +
+        'automatically. See https://github.com/reduxjs/react-redux/releases/' +
         'tag/v2.0.0 for the migration instructions.'
       )
 
diff --git a/test/components/connect.spec.js b/test/components/connect.spec.js
index 2d3e975..06951c1 100644
--- a/test/components/connect.spec.js
+++ b/test/components/connect.spec.js
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types'
 import ReactDOM from 'react-dom'
 import TestRenderer from 'react-test-renderer'
 import { createStore } from 'redux'
-import { connect } from '../../src/index'
+import { connect, createProvider } from '../../src/index'
 
 describe('React', () => {
   describe('connect', () => {
@@ -2324,5 +2324,27 @@ describe('React', () => {
       expect(mapStateToPropsC).toHaveBeenCalledTimes(2)
       expect(mapStateToPropsD).toHaveBeenCalledTimes(2)
     })
+
+    it('should receive the store in the context using a custom store key', () => {
+      const store = createStore(() => ({}))
+      const CustomProvider = createProvider('customStoreKey')
+      const connectOptions = { storeKey: 'customStoreKey' }
+
+      @connect(undefined, undefined, undefined, connectOptions)
+      class Container extends Component {
+        render() {
+          return <Passthrough {...this.props} />
+        }
+      }
+
+      const testRenderer = TestRenderer.create(
+        <CustomProvider store={store}>
+          <Container />
+        </CustomProvider>
+      )
+
+      const container = testRenderer.root.findByType(Container)
+      expect(container.instance.store).toBe(store)
+    })
   })
 })