# Fix SVG preview not refreshing on external file changes \(\#37316\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 18c6d9d394f99fa0e2e95dff385bff117a1ef5cb

Requested commit: 18c6d9d394f99fa0e2e95dff385bff117a1ef5cb

Commit: 18c6d9d394f99fa0e2e95dff385bff117a1ef5cb

Tree: a2b87d04c9afe2a2b85ec8496cae9bbe021e5069

Author: 0xshadow

Committer: GitHub

## Message

```
Fix SVG preview not refreshing on external file changes (#37316)

Closes #37208 

## Release Notes:

- Fixed: SVG preview now refreshes automatically when files are modified
by external programs

## Summary

Previously, SVG preview would only refresh when files were saved within
the Zed editor, but not when modified by external programs (like
scripts, other editors, etc.)

## What Changed

The SVG preview now subscribes to file system events through the
worktree system. When an external program modifies an SVG file, the
worktree detects the change and notifies the preview. The preview then
clears its cache and refreshes to show the updated content.

## Before the fix



https://github.com/user-attachments/assets/e7f9a2b2-50f9-4b43-95e9-93a0720749f5


## After the fix


https://github.com/user-attachments/assets/b23511e3-8e59-45a1-b29b-d5105d32bd2c

AI Usage:
Used Cursor for code generation
```

## Parents

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

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