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

DevTools: Improve props/state value editing interface #16476

Closed
bvaughn opened this issue Aug 19, 2019 · 2 comments
Closed

DevTools: Improve props/state value editing interface #16476

bvaughn opened this issue Aug 19, 2019 · 2 comments

Comments

@bvaughn
Copy link
Contributor

bvaughn commented Aug 19, 2019

Follow up to a discussion thread on #294 and a Messenger chat with @gaearon.

The current UI for editing props/state/hooks values has a couple of shortcomings:

  • strings/numeric values are sometimes of an unclear type. (DevTools uses the correct <input type> but this is subtle. Showing e.g. quotation marks around strings could be more helpful.
  • null initial values can only become strings at the moment. (DevTools does not attempt to parse numeric or boolean values and change the input type. If it did, we would probably also need to enable a way for you to opt back out of that input type somehow in case it was incorrect.)
  • fields that maybe support multiple types (e.g. string | number) are locked into a single type (whichever type they happen to be initially).

Additional quirks that might be worth ironing out:

  • Non-editable strings are currently wrapped in quotation marks but editable ones aren't.

Originally reported via bvaughn/react-devtools-experimental#321

@a-x-
Copy link

a-x- commented Aug 29, 2019

Also:

  1. nested objects shown as 'Object' strings (also, when copy props button pressed)
    Screenshot 2019-08-29 at 20 28 30
    Screenshot 2019-08-29 at 20 28 52

    {...
        "accounts": ["Object", "Object", "Object"],
        "resetForms": "fn()"
    ...}
    
  2. context menu on fn() missed. in previous devtools I was able to jump to func-prop definition source

@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 29, 2019

@a-x- The above comment doesn't really seem related to this issue. Please file a new issue?

nested objects shown as 'Object' strings (also, when copy props button pressed)

Please also include:

  • Which version of DevTools you have installed
  • Which browser you are using
  • An example project (Code Sandbox would be nice) that shows this bug. (I'm not seeing it in DevTools when I look now.)

If you look at the demo app and search for "InspectableElements", you'll see that nested arrays and objects are serialized correctly:

Screen Shot 2019-08-29 at 11 08 41 AM

DevTools also has tests specifically for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants