question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid context `storeSubscription` of type `Subscription`...

See original GitHub issue

I am seeing the following error in the Chrome dev tools:

Warning: Failed context type: Invalid context `storeSubscription` of type `Subscription` supplied to `Connect(connectForm(Form))`, expected instance of `Subscription`.

The error happens when I @connect a component that contains another connected component somewhere deeply in the tree. The error is on the nested component, not the parent component. I have tried boiling this down to a minimally reproducible case, but I am having trouble coming up with one. When I remove the @connect from my top-level component, the error goes away. I haven’t noticed any functional problems.

Any suggestions on creating a reproducible case?

FYI, the following case does not produce the error in the console:

@connect(state => ({
  hello: true,
}))
class Outer extends React.Component {
  render() {
    return <Child><Inner /></Child>;
  }
}

class Child extends React.Component {
  render() {
    return this.props.children;
  }
}

@connect(state => ({
  hello: true,
}))
class Inner extends React.Component {
  render() {
    return <span>hello</span>;
  }
}

render(<Provider store={store}><Outer /></Provider>, document.body);

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
chrisvaszcommented, Oct 26, 2016

Actually yes, that is exactly what’s happening. Sorry for the false alarm!

For future reference: React uses the instanceof operator to check the type of StoreSubscription. Since I had two copies of React Redux loading, the left side of the instanceof check was a StoreSubscription from React Redux A, and the right side of the instanceof check was from React Redux B. Whoops!

1reaction
Elijencommented, Jan 15, 2017

Happened to me today after upgrading react-redux. Seems to be caused by hot reloading. Simply restarting webpack-dev-server solved the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Warning: Failed context type: Invalid context `storeSubscription` of ...
Warning: Failed context type: Invalid context storeSubscription of type Subscription supplied to Connect(GroupsList) , expected instance of Subscription .
Read more >
angular - I get Error: Type 'Subscription' is not assignable to ...
ERROR in src/app/patient.service.ts(30,3): error TS2322: Type 'Subscription' is not assignable to type 'Observable'. Property '_isScalar' is ...
Read more >
Lightroom iPad App Store subscription error! (Rest... - Adobe ...
I'm in the middle of working and now i can't use lightroom on my ipad.. You're web support it an utter failure -...
Read more >
Sell subscriptions | Google Play's billing system
When a user upgrades, downgrades, or resignup from your app before the subscription expires, the old subscription is invalidated, and a new subscription...
Read more >
cannot pay my store subscription fee for months i... - The eBay ...
cannot pay my store subscription fee for months i get an error message when I try to pay ... Automated Assistant, type AGENT...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found