parse-community / ParseReact

Seamlessly bring Parse data into your React applications.
https://parseplatform.org
Other
1.3k stars 209 forks source link

#117 Parse-React tries to flatten elements of array even if they're not Parse Objects #157

Open mmazzarolo opened 8 years ago

mmazzarolo commented 8 years ago

Fix for https://github.com/ParsePlatform/ParseReact/pull/157

mappedFlatten(el) tried to flatten every element of the array (by calling flatten(el)) even if they are not Parse Objects, resulting in many Attempted to flatten something that is not a Parse Object warnings.

facebook-github-bot commented 8 years ago

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

facebook-github-bot commented 8 years ago

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

lrettig commented 8 years ago

For the record, there is one side effect of this change. The behavior will be different when flattening a Javascript Object which contains other (non-flattened) Objects.

Before the change, the entire Object hierarchy will be walked, and all Objects will be flattened, i.e., all parse objects will be replaced with pointers to those objects.

After the change, only the top-level object will be flattened; if it contains any objects below it, they won't be.

I noticed this because I have a Parse class with a column that contains an Object structure.

maqen commented 8 years ago

@mmazzarolo I've made some changes allowing local subscriptions (currentUser) to be refreshed, but have you any tips on how I can use my local/fork in my project? How do one create the /lib folder on npm? REACT_NATIVE=true gulp lib creates the folders needed but don't see how I can use that in my project. Any hints?