Skip to content

Updated OVERVIEW.md to the new infos required when adding a new leaf node to the tree #19981

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

Merged
merged 2 commits into from
Oct 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions packages/react-devtools/OVERVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,28 @@ Later operations will reference strings by a one-based index. For example, `1` w

#### Adding a root node

Adding a root to the tree requires sending 4 numbers:
Adding a root to the tree requires sending 5 numbers:

1. add operation constant (`1`)
1. fiber id
1. element type constant (`8 === ElementTypeRoot`)
1. element type constant (`11 === ElementTypeRoot`)
1. profiling supported flag
1. owner metadata flag

For example, adding a root fiber with an id of 1:
```js
[
1, // add operation
1, // fiber id
8, // ElementTypeRoot
11, // ElementTypeRoot
1, // this root's renderer supports profiling
1, // this root has owner metadata
]
```

#### Adding a leaf node

Adding a leaf node takes a variable number of numbers since we need to decode the name (and potentially the key):
Adding a leaf node to the tree requires sending 7 numbers:

1. add operation constant (`1`)
1. fiber id
Expand All @@ -86,7 +88,6 @@ For example, adding a function component `<Foo>` with an id 2:
1, // ElementTypeClass
1, // parent id
0, // owner id
3, // encoded display name size
1, // id of "Foo" displayName in the string table
0, // id of null key in the string table (always zero for null)
]
Expand Down