-
Notifications
You must be signed in to change notification settings - Fork 67
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
Needs a feature to copy/paste or download the current state object #60
Comments
I would suggest to implement this in |
My intuition says a solution involving text selection might not be the right solution here. Consider this screenshot; A bunch of rhetorical questions; Where does the selection begin and end? Why are some keys not selected/selectable? What should happen with the selected bits that aren't part of the JSON syntax? Should they be selectable at all? Should they indicate selection of a specific part of the state object? If so, which? It's worth noting that you can't copy and paste the representation of a JS object in the Chrome Devtools either. For my personal use-case a simple button or context menu item that copies the pretty-printed result of |
Well, the screenshot isn't related to the current repo, it's from So, when you right click on However, for Inspector Monitor we'll be able to export only a part of state or action object from a context menu, so adding a button there would make sense. In case we add a menu, then those parts you pointed shouldn't be selectable at all. |
If we get this context menu with the corresponding part of the object, it will be possible even to implement inline editing as suggested in zalmoxisus/remote-redux-devtools#32. Or make this part of the object available in the console as per zalmoxisus/redux-devtools-extension#132. Though, for most use cases a button as you suggested could be enough. Related to zalmoxisus/redux-devtools-extension#157. |
joshwcomeau/redux-vcr/issues/1 records the series of Redux actions and would like to share functionality with redux-devtools. Might be relevant. |
Thank you very much for the We would just need a "Copy as JSON" button in the State > raw tab. |
Kind of a late response.. the devtools are definitely still lacking this seemingly very important and useful feature. In the meantime I'd recommend popping the redux store onto the window itself and then doing the following: window.myGlobalStore.getState() Then it's as easy as finding the object you're interested in and right clicking to copy it: |
I've had a few situations where it would be really convenient for me to get a copy of just the current state object either saved to a pretty-printed JSON file or copied to the clipboard. The existing download button is similar, but since it downloads actions and computed state, I have to shave a few more yaks to get a clean copy of the state object.
The current best solution I have is to use react-devtools to select my
<Provider/>
component and then pasteJSON.stringify($r.store.getState())
into the console. This works, but requires multiple unintuitive clicks, remembering or finding that code snippet, and then formatting the output.Since this is something I run into often, it would reduce a lot of friction to have a more streamlined solution, like a "Copy current state to Clipboard" button somewhere in the UI. Another user suggested being able to copy the contents of the log monitor panel just by clicking and dragging, which is another potential solution that would work for this use case.
I'm more than happy to open a PR for this and implement the feature, but before I spend a lot of time on it, I just wanted to check whether or not this is a feature you'd be interested in merging, and if you have any thoughts about the design of the UI/UX for this feature.
The text was updated successfully, but these errors were encountered: