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

Allow Symbol keys in observable maps (fixes #1925) #1930

wants to merge 1 commit into
base: master


None yet
2 participants
Copy link

pimterry commented Mar 14, 2019

  • Added unit tests
  • Updated changelog
    • Not clear what the 'right' way to do this is, seems lots of PRs ignore it? I've added an 'Unreleased' section ready to rename for the next release for now.
  • Updated docs (either in the description of this PR as markdown, or as separate PR on the gh-pages branch. Please refer to this PR). For new functionality, at least should be updated
    • No changes necessary imo
  • Added typescript typings
    • No types have changed
  • Verified that there is no significant performance drop (npm run perf)

@mweststrate you mentioned safeStringify in #1925, I couldn't find that - looks like it's a function in the mobx-state-tree codebase?

I've written a separate key stringification function instead. Here it actually doesn't use JSON.stringify, because JSON can't represent symbols, and they're normally omitted from JSON stringified objects. For the same reason, I've also preserved symbol-ness in toPOJO here, instead of stringifying them, which feels correct, and helpfully means we get the correct behaviour (symbol keys omitted) in toJSON here too.


This comment has been minimized.

Copy link

coveralls commented Mar 14, 2019

Coverage Status

Coverage increased (+0.006%) to 93.877% when pulling 9f12565 on pimterry:symbol-map-keys into 4451340 on mobxjs:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.