diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/index.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/index.js b/src/index.js index e94dec9..8cad259 100644 --- a/src/index.js +++ b/src/index.js @@ -153,6 +153,7 @@ class GraphContainer extends Component { context: { '@embed': '@never' }, replies: { '@embed': '@never' }, inReplyTo: { '@embed': '@never' }, + attributedTo: { '@embed': '@always' }, }, }, { omitGraph: true } @@ -225,8 +226,20 @@ class SelectionContainer extends Component { } class CollapseContainer extends Component { + /** + * Contains the collapse-state for each node. + * + * - `false`: visible + * - `true`: implicitly hidden + * - `'explicit'`: explicitly hidden + */ state = {}; + /** + * Toggle a node's collapse-state. + * - `false` → `'explicit'` + * - `true`, `'explicit'` → `false` + */ toggle = (id) => { const { items } = this.props; @@ -236,6 +249,14 @@ class CollapseContainer extends Component { this.setState(this.update(items[id], state)); } + /** + * Recursively update child node's collapse-state. + * + * If a node has parents and they are all collapsed, + * mark that node as implicitly hidden (`true`). + * + * Then update all of that node's children. + */ update(node, state) { const { items } = this.props; |
