# Don't register an entity ID extractor for non-entity subscriptions · gitcafe/zed

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

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

Visibility: public

Requested revision: d7fcb049d4d726ed4e13f95b3be948300ea3b6f3

Requested commit: d7fcb049d4d726ed4e13f95b3be948300ea3b6f3

Commit: d7fcb049d4d726ed4e13f95b3be948300ea3b6f3

Tree: 4f528d3684fcf10459901eda7f3edfbc081e750a

Author: Antonio Scandurra

Committer: Antonio Scandurra

## Message

```
Don't register an entity ID extractor for non-entity subscriptions

This commit fixes a panic that could occur when registering N subscriptions for
N entities of the same kind. Before, when dropping the first of the
subscriptions, we would remove the entity ID extractor as well. This was,
however, used by all the other N - 1 subscriptions which would then start
losing messages. In addition, dropping yet another subscription of that kind
would result in a panic, because we wouldn't find the extractor in the map
upon invoking `Subscription::drop`.

With this change we will avoid removing the ID extractor when dropping a
subscription. Crucially, we also avoid inserting extractors for simple message
subscriptions. This enables these non-entity subscriptions to be dropped and
re-registered without seeing a "registered handler for the same message twice"
panic.

```

## Parents

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

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