-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alternative of Proxy #40
Comments
Hi, thanks for opening up a discussion. Somewhat related issue: dai-shi/react-tracked#6 btw, proxy-memoize uses WeakMaps. You would also need a polyfill, but then it will probably leak memory... |
I see I see
ah, got it, I wasn't aware of this before I also have a new proposal to avoid the problems(Proxy, WeakMaps). it's more concerned with As I roughly read the source code of these two libs, the WeakMaps is mainly used for weakly storing the object type and properties path, so according to the react scenario I talked about:
I understand I knew |
Actually, the WeakMap cache in proxy-memoize would work best with redux state. It provides infinite cache size with no memory leaks. So, your proposition is |
I think still can have proxy and weakmap, add a toggle to open es5 support as a workaround, like |
I would like to know if that works in your case practically. Technically |
Just looking at this: https://github.com/polygonplanet/weakmap-polyfill
No, it doesn't leak memory. |
https://github.com/zloirock/core-js |
yes, that's my original plan, but follow this issue, global
that's great, so the WeakMap isn't the problem. |
Okay, this is very unfortunate. I think polyfill shouldn't do this, but understandable. |
Please try #41. |
Wow, you are so productive!!, I saw your workaround, there is little gap from my expectation, I have to handle the compatibility with immerjs if I use Anyway, your change for this lib is perfect, thanks for your time and effort, I think can close this issue. |
Hmm, that doesn't sound ideal.
Yeah, please go ahead.
I actually need your feedback, if #41 really solves your use case. |
Please check the new commit in #41. |
ah, I also take a look of this
sure sure, no problem, any question I will also put in this, I am developing a redux tool named create-hooks-slice, currently it's highly dependent on
wow, that's fascinating, hope this |
Once you confirm #41 works as expected, I will cut a new release and release |
done the MR approval! |
got it, thanks |
hi, I am trying to use lib proxy-memoize in our website to replace
reselect
, but our website serves customers, so need be compatible with as many browsers as possible, butproxy-polyfill
can't work with this lib, since the polyfill only support a limited scope traps, not includehas
,deleteProperty
and so on.I also take a look of
immerjs
to check how it works in non-proxy environment, it useObject.defineProperty
instead, so what I think is:setUseProxies
to disable using Proxy.Object.defineProperty
implementation, for this scenario, only support limit recording method.get
andset
getOwnPropertyDescriptor
andownKeys
are rarely used and also reasonable if not record them.has
anddeleteProperty
are big problems, only hope the developers notice to don't use them.obj['a']
instead of'a' in obj
const { ...newObj, a } = obj
instead ofdelete obj.a
then I think
proxy-memoize
can have a widely usage scenarios, hope can as a default selectorCreator be putted in the redux-toolkit one day ^_^The text was updated successfully, but these errors were encountered: