Introduce support for Symbol named observable properties
See original GitHub issueWelcome to MobX. Please provide as much relevant information as possible!
I have a:
- Question: Feel free to just state your question. For a quick answer, there are usually people online at our Gitter channel
- Documentation improvement. Please don’t open an issue but create a PR instead!
- Issue:
- Provide error messages including stacktrace
- Provide a minimal sample reproduction. Create a reproduction based on this sandbox
- Did you check this issue wasn’t filed before?
- Elaborate on your issue. What behavior did you expect?
- State the versions of MobX and relevant libraries. Which browser / node / … version?
- Idea:
- What problem would it solve for you?
- Do you think others will benefit from this change as well and it should in core package (see also mobx-utils)?
- Are you willing to (attempt) a PR yourself?
Please tick the appropriate boxes. Feel free to remove the other sections.
Please be sure to close your issues promptly.
What
error 'set' on proxy: trap returned falsish for property 'Symbol(count)'
threw when using Symbol as key in an observable,
How to reproduce
- click the add button in normal section works fine
- click the add button in symbol section broken 😦
Issue Analytics
- State:
- Created 5 years ago
- Comments:16 (9 by maintainers)
Top Results From Across the Web
Classifying Objects Based on their Observable Properties
Students are introduced to the idea that objects and materials have certain “properties”or “characteristics” that can be used to describe them.
Read more >Observable - SimBiology - MathWorks
An observable object is a mathematical expression that lets you perform post-simulation calculations.
Read more >STIX™ Version 2.1 - OASIS Open
This document provides a language for expressing cyber threat and observable information. It defines the concepts and overall structure of the STIX ...
Read more >Symbol - JavaScript - MDN Web Docs
Chrome Edge
Symbol Full support. Chrome38. Toggle history Full support. Edge12. footnote...
@@toPrimitive Full support. Chrome47. Toggle history Full support. Edge15. Toggle...
Symbol() constructor Full support....
Read more >1.3: Properties of Matter - Chemistry LibreTexts
Although mass and volume are both extensive properties, their ratio is an important intensive property called density (ρ).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Mobx ignores non-enumerable props (like symbols) in
observable/extendObservable
. The symbol is firstly introduced to the observable object during the assignment (inincSymbol
). Mobx4 doesn’t support dynamic keys, so the standard JS behavior (new non-observable property is added to object) takes place, therefore no error. In Mobx5 proxy handler returns false for non-string keys, resulting in TypeError.I don’t think so. Symbols are accessible via
Object.getOwnPropertySymbols()
, returning an empty array on empty objects. The argument passed toobservable/extendObservable
represents simple property list - not an arbitrary “smart” object (eg an object implementing a well known symbol). So if there is a symbol, it’s introduced by user and should be made observable imho (no matter what symbol it is, similary to providingtoString
orvalueOf
).Released as 4.10.0 / 5.10.0. Thanks @loklaan !