Open taou-maimai opened 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?
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.
Published as 1.2.1
Thanks.
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.