# Cache view's type id and keymap context into a separate map · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/18e39ef2fa3a20493fc9827641df4f0b9d170ed7)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 18e39ef2fa3a20493fc9827641df4f0b9d170ed7

Requested commit: 18e39ef2fa3a20493fc9827641df4f0b9d170ed7

Commit: 18e39ef2fa3a20493fc9827641df4f0b9d170ed7

Tree: db938fb6a6f1a7132c4c03835ea1b6498f0eee5a

Author: Antonio Scandurra

Committer: Antonio Scandurra

## Message

```
Cache view's type id and keymap context into a separate map

During `layout`, we now pass a mutable reference to the element's
parent view. This is a recursive process that causes the view to
be removed from `AppContext` and then re-inserted back into it once
the layout is complete.

As such, querying parent views during `layout` does not work as such
views will have been removed from `AppContext` and not yet re-inserted
into it. This caused a bug in `KeystrokeLabel`, which used the `keystrokes_for_action`
method to query its ancestors to determine their type id and keymap context.

Now, any time a view notifies, we will cache its keymap context so that
we don't need to query the parent view during `layout`.

```

## Parents

- [053b34875b73088dc2a1374981a664831505d4e2](https://git.cafe/gitcafe/zed/commit/053b34875b73088dc2a1374981a664831505d4e2?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/18e39ef2fa3a20493fc9827641df4f0b9d170ed7?format=markdown)
