# agent_ui: Switch to All filter when last archived thread is removed \(\#54763\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 03064b953fefbe2f4070f856b64484131d8f6ec9

Requested commit: 03064b953fefbe2f4070f856b64484131d8f6ec9

Commit: 03064b953fefbe2f4070f856b64484131d8f6ec9

Tree: c5c4dba1fc1b25fabba9e478bf464036b51ee81b

Author: XiaoYan Li

Committer: GitHub

## Message

```
agent_ui: Switch to All filter when last archived thread is removed (#54763)

When the archive view's filter is set to "Archived Only" and the user
deletes (or unarchives) the last archived thread, the toggle button
becomes disabled because there are no archived threads left. With the
filter still pinned to "Archived Only", the list goes empty and there's
no way for the user to switch back to the All view.

This fixes it by automatically falling back to `ThreadFilter::All`
inside `update_items` whenever the current filter is `ArchivedOnly` but
the store has no archived entries. Since `update_items` is invoked from
the `ThreadMetadataStore` observer, this covers all paths that mutate
the store, not only deletions triggered from this view.

Release Notes:

- Fixed the agent thread archive view getting stuck on an empty
"Archived Only" list after the last archived thread was removed.

---------

Co-authored-by: Neel <neel@zed.dev>
```

## Parents

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

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