mobxjs / mobx-react

React bindings for MobX
https://mobx.js.org/react-integration.html
MIT License
4.85k stars 350 forks source link

upgrade mobx-react version from 6.2.2 to 6.2.3,There is an error #887

Closed zengqingzhuang closed 4 years ago

zengqingzhuang commented 4 years ago

image

danielkcz commented 4 years ago

Please create a small reproduction.

joelharkes commented 4 years ago

Yes have the same issue:

image

We provide same component twice, because we use it for different stores, now it starts throwing errors. its quite annoying i had to downgrade to keep it working.

reproducable by calling observer() twice on same class method but doing it manually:

var observedClass1 = observer(ClassName);
var observedClass2 = observer(ClassName);
joelharkes commented 4 years ago

It would be nice to at least be able to disable this error/warning.

mweststrate commented 4 years ago

"We provide same component twice, because we use it for different stores"

Why do you need to wrap a component twice in observer twice because you use it for two different stores? Please provide some example code why the warning wouldn't be correct in your case.

On Mon, Jul 27, 2020 at 3:04 PM Joël Harkes notifications@github.com wrote:

It would be nice to at least be able to disable this error/warning.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mobxjs/mobx-react/issues/887#issuecomment-664416127, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAN4NBADBVTCVVISPC5TVE3R5WCNNANCNFSM4PINWIYA .

bigdrum commented 4 years ago

The warning is fine. The real problem is getDisplayName (https://github.com/mobxjs/mobx-react/blob/376bff72d84ae8d342c55d1fb25ff81a223624d2/src/observerClass.ts#L26) is passed with a undefined value; and it is not properly handled.

danielkcz commented 4 years ago

We will publish a fix soon, it was merely an oversight. Stick to the previous version for now, please.

mweststrate commented 4 years ago

Just release 6.2.4. Thanks for reporting!