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: Ability to save inspected values as global variable (as it was in previous version) #16541

Closed
val-o opened this issue Aug 22, 2019 · 11 comments

Comments

@val-o
Copy link

val-o commented Aug 22, 2019

Hi, I really like new dev tools (4.0.5), but I would like to request one useful feature.

In previous version it was possible to save inspected value (prop/state/context) and its parts as a global variable using context menu->store as global variable, so it can be easily be accessed through console using $tmp{n}. In current version this is behaviour was replaced be creating new "bug" button which will just print all values in console. Unfortunately it's hard to navigate through this object, because $_ in console will return undefined. And in order to access it you need to expand group, find desired property and open context menu->store as global variable.
It would be perfect if you combine these 2 approaches so it would be possible to both print values using "bug" button and opening context menu directly in react dev tools panel wihtout need of intermediate step.

Thanks!

@val-o val-o changed the title DevTools: Ability to save inspected values as global variable (as it a previos version ) DevTools: Ability to save inspected values as global variable (as it was in previous version) Aug 22, 2019
@gaearon
Copy link
Collaborator

gaearon commented Aug 22, 2019

Maybe values in the tree could have a "bug" button next to them too that appears only on hover.

@bvaughn
Copy link
Contributor

bvaughn commented Aug 23, 2019

See issue #16428

I don't personally think this needs to be a top level button. You can still store global vars using the console itself and the existing UI:

store-Kapture 2019-08-16 at 13 19 57

@bvaughn
Copy link
Contributor

bvaughn commented Aug 23, 2019

Maybe values in the tree could have a "bug" button next to them too that appears only on hover.

This is a little tricky in some edge cases (really close to the right/left side) and probably not the greatest in terms of accessibility (although we have a lot of areas we could stand to improve on in this regard).

@val-o
Copy link
Author

val-o commented Aug 23, 2019

@

See issue #16428

I don't personally think this needs to be a top level button. You can still store global vars using the console itself and the existing UI:

store-Kapture 2019-08-16 at 13 19 57

Hi @bvaughn, the problem in this flow is that you need to do 3 steps:

  1. click on bug
  2. expand a group and find desired field
  3. right click to store it as global var.
    On the other hand, in previous version you can directly store desired property through react dev tools.
    Maybe just enable old context menu in the right panel of react dev tools?

@bvaughn
Copy link
Contributor

bvaughn commented Aug 23, 2019

It's slightly more clicks (3 vs 2) but I don't think that necessarily means we need to change it. I don't think this is a very common interaction, and screen real estate is pretty precious in a DevTools.

@gaearon
Copy link
Collaborator

gaearon commented Aug 24, 2019

It's slightly more clicks (3 vs 2)

I think @AkhmedovValikhan's point is that usually you start inspecting props/state inline, get to some nested field, and then realize you want to save it. So it's not just one click more; you have to redo the whole "find the nested field" thing after logging.

@jsc144
Copy link

jsc144 commented Aug 26, 2019

+1 this feature was very helpful for debugging in the previous version. Now debugging at run time takes longer and is less intuitive.

@bvaughn

It's slightly more clicks (3 vs 2) but I don't think that necessarily means we need to change it. I don't think this is a very common interaction, and screen real estate is pretty precious in a DevTools.

This feature was in the context menu, so how does it affects screen real estate?

@pauls-ai2
Copy link

Moreover, it seems like you can't make a context item a global any more. With the new bug icon, it logs out props, state, and nodes; but not context.

@bvaughn
Copy link
Contributor

bvaughn commented Aug 27, 2019

@pauls-ai2 For class components, context should still accessible via the $r mechanism I showed above.

For function components (useContext) it would be inside of the hooks array, which is admittedly a little more difficult to get to but it's there:
Screen Shot 2019-08-27 at 10 26 54 AM

@bvaughn bvaughn removed their assignment Sep 3, 2019
@stale
Copy link

stale bot commented Jan 10, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution.

@stale stale bot added the Resolution: Stale Automatically closed due to inactivity label Jan 10, 2020
@stale
Copy link

stale bot commented Jan 17, 2020

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!

@stale stale bot closed this as completed Jan 17, 2020
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

5 participants