# project_panel: Fix autoscroll and filename editor focus race condition \(\#42739\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 524b97d729a1309ac7ab0b1d586c592571b574c8

Requested commit: 524b97d729a1309ac7ab0b1d586c592571b574c8

Commit: 524b97d729a1309ac7ab0b1d586c592571b574c8

Tree: ae1440efbc64ab0580044d1cca68136f84dac8c6

Author: Smit Barmase

Committer: GitHub

## Message

```
project_panel: Fix autoscroll and filename editor focus race condition (#42739)

Closes https://github.com/zed-industries/zed/issues/40867

Since the recent changes in
[https://github.com/zed-industries/zed/pull/38881](https://github.com/zed-industries/zed/pull/38881),
the filename editor is sometimes not focused after duplicating a file or
creating a new one, and similarly, autoscroll sometimes didn’t work. It
turns out that multiple calls to `update_visible_entries_task` cancel
the existing task, which might contain information about whether we need
to focus the filename editor and autoscroll after the task ends. To fix
this, we now carry that information forward to the next task that
overwrites it, so that when the latest task ends, we can use that
information to do the right thing.

Release Notes:

- Fixed an issue in the Project Panel where duplicating or creating an
entry sometimes didn’t focus the rename editing field.
```

## Parents

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

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