Skip to content

Lazily send props/state/hooks across the bridge#325

Merged
bvaughn merged 8 commits intomasterfrom
hydration
Jun 18, 2019
Merged

Lazily send props/state/hooks across the bridge#325
bvaughn merged 8 commits intomasterfrom
hydration

Conversation

@bvaughn
Copy link
Copy Markdown
Owner

@bvaughn bvaughn commented Jun 15, 2019

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:
ezgif com-gif-maker

@bvaughn bvaughn force-pushed the hydration branch 2 times, most recently from 0c042b0 to 707a5e1 Compare June 16, 2019 16:46
@bvaughn bvaughn changed the title [wip] Add hydration support Lazily send props/state/hooks across the bridge Jun 17, 2019
@bvaughn bvaughn merged commit 3988c27 into master Jun 18, 2019
@bvaughn bvaughn deleted the hydration branch June 18, 2019 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bad performance with Destiny Item Manager site

1 participant