arunoda / react-komposer

Feed data into React components by composing containers.
MIT License
732 stars 70 forks source link

Error: Tyring set data after component(Container(ChartData)) has unmounted. #152

Open zeroasterisk opened 7 years ago

zeroasterisk commented 7 years ago

I keep seeing this error, for a dataLoader function which is very fast.

Is there a chance the dataLoader is trying to set the data into the component before it is actually mounted?

davidworkman9 commented 7 years ago

Also getting this when using a controlled component and someone types quickly.

Dartv commented 7 years ago

Not sure about v2 but if you look at the code in v1 it actually sets data in constructor and not in componentWillMount which will cause errors if you try to dispatch some redux actions there. Maybe it's related to this issue.

flippyhead commented 7 years ago

Anyone happen to figure this out? Following the recommended setup we see this after routing (with react router) and it causes the app to completely break.

flippyhead commented 7 years ago

Actually we found this was caused by the mapper function for redux not returning the result of subscribe (which is a function that unsubscribes from the store).

kieckhafer commented 7 years ago

Any solution to this? We are also seeing this issue. We have a sidebar that has our komposer container inside of it. When we close the sidebar, the container seems to re-render as it's closing.

In our container, we fetch our data via a Meteor.call. This call is seeming to happen again during this re-render when we close our sidebar, and I assume the component is unmounted before the data is sent back, causing this same issue.

If I provide static data, instead of doing the Meteor call, then everything is fine.

McPo commented 6 years ago

I am also running into this issue.

Here is some pseudo code.

const exampleComposer = (props, onData) => {
    doSomething(() => onData(..));
    return cancelDoSomething;
};

I am making a network call in doSomething. If I navigate away and the component becomes unmounted, I would be expecting cancelDoSomething to be called, but it appears that it is not. (I have verified this via logging). Instead I am getting the following error.

Error: Tyring set data after component

The solution for me at the moment, is to just catch the error that was thrown. Which isn't great.