Skip to content

connect assumes store prop is a redux store #1393

Closed
@aaronjensen

Description

@aaronjensen

Do you want to request a feature or report a bug?

(If this is a usage question, please do not post it here—post it on Stack Overflow instead. If this is not a “feature” or a “bug”, or the phrase “How do I...?” applies, then it's probably a usage question.)

What is the current behavior?

When you pass a store prop to a connected component, it attempts to use the value of the prop as a redux store. This is wreaking havoc on our codebase that has store as a commonly passed prop. I haven't been able to find any documentation for this behavior and I can't find a way to override it, though it does seem to be intentional:

https://github.com/reduxjs/react-redux/blob/master/src/components/connectAdvanced.js#L197

It even seems at one point there was a way to override this behavior:

https://github.com/reduxjs/react-redux/blob/master/src/components/connectAdvanced.js#L115

I'm filing this as a bug because as far as I can tell, #1000 removed this behavior and disabled the override key and then #1209 added it back in, without reenabling the override key. My guess is that this wasn't intentional and hope that adding the override key back would be acceptable.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to a CodeSandbox (https://codesandbox.io/s/new) or RN Snack (https://snack.expo.io/) example below:

Repro is obvious, but I can add one if desired.

What is the expected behavior?

Either connect would not use the store prop at all, or the name would be overridable (likely preferred since it would be a less breaking change).

Which versions of React, ReactDOM/React Native, Redux, and React Redux are you using? Which browser and OS are affected by this issue? Did this work in previous versions of React Redux?

react-redux 7.1.1
redux 4.0.4
react/react-dom 16.8.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions