Skip to content
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

onBecome(Un)Observed didn't trigger when use number as key of observable map #2067

Closed
3 tasks done
wayne-liberty opened this issue Aug 5, 2019 · 5 comments
Closed
3 tasks done
Labels

Comments

@wayne-liberty
Copy link

wayne-liberty commented Aug 5, 2019

[x] Issue:

  • a minimal sample reproduction. sandbox
  • Elaborate on your issue. What behavior did you expect?

when use number as key of observable map, onBecomeObserved didn't trigger callback, but it worked fine when using string as key

  • State the versions of MobX and relevant libraries. Which browser / node / ... version?

mobx: 5.13.0

@urugator
Copy link
Collaborator

urugator commented Aug 5, 2019

I think the problem is here:

typeof arg2 === "string" ? getAtom(thing, arg2) : (getAtom(thing) as any)
const cb = typeof arg2 === "string" ? arg3 : arg2

It should go like:

const atom: IObservable =
   typeof arg3 === "function" ? getAtom(thing, arg2) : (getAtom(thing) as any)
const cb = typeof arg3 === "function" ? arg3 : arg2

PR welcome

@wayne-liberty
Copy link
Author

ok, I'll try

@wayne-liberty
Copy link
Author

wayne-liberty commented Aug 11, 2019

PR is made: #2073. It's my first time doing PR, please help review.

@danielkcz
Copy link
Contributor

PRs merged for both versions #2073 #2075

@lock
Copy link

lock bot commented Nov 9, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or questions.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants