feat(reactotron-core-ui): add copy button for nested objects in API response #1597
Open
Deepakmukka1 wants to merge 1 commit intoinfinitered:masterfrom
Open
feat(reactotron-core-ui): add copy button for nested objects in API response #1597Deepakmukka1 wants to merge 1 commit intoinfinitered:masterfrom
Deepakmukka1 wants to merge 1 commit intoinfinitered:masterfrom
Conversation
nested objects in TreeView Allow users to copy nested object JSON from the TreeView component via a Copy button that appears next to object type indicators. The copyToClipboard callback is threaded through ContentView and TreeView to the ApiResponseCommand response body tab.
Author
|
Hey @silasjmatson @joshuayoes could you please let me know if this feature would be useful? I often found myself wanting to copy just a nested object in a large API response, so I thought of adding this. If it makes sense to include, I’d really appreciate a review on the PR. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please verify the following:
yarn build-and-test:localpassesREADME.md(or relevant documentation) has been updated with your changesDescribe your PR
Adds a Copy button for nested objects in the
TreeViewcomponent inside the Response Body tab.This allows users to quickly copy the JSON representation of any nested object in an API response without manually selecting or expanding large sections of the tree.
Motivation
Previously, Reactotron only allowed copying top-level values.
When API responses contained deeply nested objects, users had to manually expand the tree and select the text to copy.
This change enables one-click copying of any nested object, improving the developer experience when inspecting API responses.
Implementation
TreeView/index.tsx
copyToClipboardpropButtonCopynext to object-type nodes (e.g.{3})JSON.stringify(data, null, 2)when clickedevent.stopPropagation()so clicking the button does not toggle the nodeContentView/index.tsx
copyToClipboarddown toTreeViewApiResponseCommand/index.tsx
copyToClipboardhandler toContentViewfor the Response Body tabTest Plan and Preview