React-devtools: Electron shell data transfer is lossy

Created on 9 Mar 2017  ·  10Comments  ·  Source: facebook/react-devtools

Since Electron shell uses JSON as transfer format, it loses some data, such as undefined values in objects, and sparsity of arrays. See my comments in https://github.com/facebook/react-devtools/pull/536#issuecomment-285235927.

I'm not sure how to solve this but it is confusing to have this disparity between shells.

complex good first bug

Most helpful comment

Does it really matter though, if it’s only inside DevTools?

All 10 comments

Maybe we should use something like https://github.com/cognitect/transit-js instead of JSON as transport?

transit-js is quite a lot of code (10K gzipped), maybe there's something smaller that can be used to achieve the same effect?

Does it really matter though, if it’s only inside DevTools?

Not really, those are my web development habits speaking 😄

yeah, transit could be a good thing to do

@gaearon
I took a look at transit-js & have tried adding it to react-devtools.
Potential issues with it:

Are there any alternatives people know of?

Interesting. I am not aware of alternatives but I'm fairly sure somebody must have solved this problem before.

Theres also http://msgpack.org/ but that seems to be more concerned with compression than with consistency across null/undefined/NaN

Okay I've modified the JSON2 parse and stringify functions to support undefined, NaN, Infinity, -Infinity. They were omitted from JSON because they are references to their global respectives (I think properties of the Number type). I think disregarding the potential security problems I read about/ spec will work for our use case.

https://github.com/davidfurlong/JSON-js

React DevTools has been rewritten and recently launched a new version 4 UI. The source code for this rewrite was done in a separate repository and now lives in the main React repo (github.com/facebook/react).

Because version 4 was a total rewrite, and all issues in this repository are related to the old version 3 of the extension, I am closing all issues in this repository. If you can still reproduce this issue, or believe this feature request is still relevant, please open a new issue in the React repo: https://github.com/facebook/react/issues/new?labels=Component:%20Developer%20Tools

Was this page helpful?
0 / 5 - 0 ratings