# pane: Update pinned tab count when it exceeds actual tab count \(\#33405\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 8f9817173d749183966e1c9ac526baf5d720730d

Requested commit: 8f9817173d749183966e1c9ac526baf5d720730d

Commit: 8f9817173d749183966e1c9ac526baf5d720730d

Tree: cfec22e6f84dcbdf7c18dc158ce01a837bc7fd99

Author: vipex

Committer: GitHub

## Message

```
pane: Update pinned tab count when it exceeds actual tab count (#33405)

## Summary

This PR improves the workaround introduced in #33335 that handles cases
where the pinned tab count exceeds the actual tab count during workspace
deserialization.

## Problem

The original workaround in #33335 successfully prevented the panic but
had two issues:
1. **Console spam**: The warning message was logged repeatedly because
`self.pinned_tab_count` wasn't updated to match the actual tab count
2. **Auto-pinning behavior**: New tabs up until you exceed the old safe
tab count were automatically pinned after the workaround was triggered.

## Solution

Updates the defensive code to set `self.pinned_tab_count = tab_count`
when the mismatch is detected, ensuring:
- The warning is only logged once when encountered.
- New tabs behave normally (aren't auto-pinned)
- The workspace remains in a consistent state

This is an immediate fix for the workaround. I'll attempt to open up a
follow-up PR when i get the chance that will address the root cause by
implementing serialization for empty untitled tabs, as discussed in
#33342.

Release Notes:

- N/A
```

## Parents

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

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