You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.
Yea, I noticed that as well and it's a kinda main reason why I am mostly using useObserver whenever I can. In other cases, I just have a named function.
Either way, these are just workarounds for sure. Personally, I haven't use Proxy for anything yet. There is an obvious problem it's not supported in IE11 so it would need some ponyfill. And it shouldn't be used in a production code.
Um, could you try to make some preliminary PR? Ideally with tests. I am definitely preoccupied for next weeks.
Either way though, since Reaction takes a plain string any name change after the fact would require a reaction destruction and re-creation, so maybe it could be added as an option to observer instead (displayName?: string)?
That's a really ugly escape hatch :) I would rather avoid things that cannot be compiled away from a production build. I cannot help it but using named function instead of anonymous one comes to be as the best solution really.
Another approach I just spotted in some chatroom. This way the observer grabs the name correctly.
constItem=()=><div/>exportdefaultobserver(Item)
I've decided to reconsider this whole thing. It's not really a bug. It's coming from the way JS works. Some sufficient approaches have been described, for now, so I am closing.
Since we write it as:
It won't pick up the displayName. Perhaps observer could use a proxy to pick that up:
Not sure if Mobx accepts it "after its created" so to speak, but for now I just see a ton of
observer()
in my reaction logs which isn't very helpful.The text was updated successfully, but these errors were encountered: