Conversation
0c042b0 to
707a5e1
Compare
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.
Resolves #195 (and generally improves performances for props-heavy components)
Prior to this change, inspecting a component serialized the first 5 nested levels of props/state/context data. This was okay for most cases- but in some extreme cases (objets with a lot of nested properties) this could cause a performance bottleneck. After this PR, we truncate nested objects much more aggressively. Now we only send their data over the bridge on-demand (similar to how v3 DevTools worked).
Internally, this technique is referred to as "dehydrating" and "hydrating" the values. Past a certain depth, nested values get "dehydrated" such that only metadata is sent across the bridge. The UI then requests these values be "hydrated" on-demand (when the user expands them) to fill in the missing data.
The old DevTools also had a pretty annoying behavior when it came to inspected props (see e.g. facebook/react-devtools#1296, facebook/react-devtools#1335). Specifically, when a component that had been "hydrated" updated, the hydration state was lost and all expanded paths were collapsed again. This PR does not preserve that behavior. Once a path has been "hydrated" it will not be dehydrated again by an update.
Here is a before (left) and after (right) comparison:
