dustingetz / react-cursor

Immutable state for React.js
1.03k stars 50 forks source link

Support server side rendering #62

Open taou-maimai opened 9 years ago

dustingetz commented 9 years ago

I think your change is safe but I need to be certain, so I need to write some tests before I merge this. The memoizer stuff is hard to reason about and there are some weird edge cases to consider, like if there are multiple react roots on the page, so the caches have to be separate.

dustingetz commented 9 years ago

If I went ahead and implemented https://github.com/dustingetz/react-cursor/issues/17, that would also fix your use case, right?

taou-maimai commented 9 years ago

Even if there are multiple react roots on the page(and Cursor.build is called on each root state), the function 'memoizeFactory()' in util.js is called only once (another issue?) and only one 'cache' exists. It makes no difference moving that to package scope.

So I think you can safely merge my change as a stop-gap and pub it to npm, then I am able to use 'react-cursor' in my project without changing library name in package.json to that of my fork.

dustingetz commented 9 years ago

Published as 1.2.1

taou-maimai commented 9 years ago

Thanks.