ssrwpo / ssr

SSR - Router with SSR for Node & Meteor
https://ssrwpo.github.io/ssr/
MIT License
93 stars 16 forks source link

nested asymetricSsr #73

Closed sakulstra closed 7 years ago

sakulstra commented 7 years ago

Not sure if this is a real bug as it doesn't make a lot of sense to nest asymetricSsr components below each other. Anyways I tried to and it caused some errors as the nested component may get unmounted before requestAnimationFrame is fired which results in :

Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the _class component.
componentDidMount() {
      requestAnimationFrame(() =>
        // component may be already unmounted now
        this.setState({ mounted: true }),
      );
    }
PEM-- commented 7 years ago

Indeed, nesting asymetricSsr is really not a good idea. I don't see how we could introspect the provided component and warn the user about his mistake. Event if it was feasible, a complex hierarchy of components couldn't be analyzed without deep and costly analysis. And I'm not even touching composition...

Well, nothing to be done here, but thanks for the info.

cbilotta commented 7 years ago

Actually I also have this problem even with no nested asymetricSsr :/