Skip to content

add debounce on file watcher for theme app extensions#7163

Open
EvilGenius13 wants to merge 1 commit intomainfrom
theme-app-extension-debounce
Open

add debounce on file watcher for theme app extensions#7163
EvilGenius13 wants to merge 1 commit intomainfrom
theme-app-extension-debounce

Conversation

@EvilGenius13
Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Similar to #6791

The theme app extensions file watcher doesn't have the same debounce setup as we did for the regular theme file system.

WHAT is this pull request doing?

Brings the logic to theme app extensions as well.

How to test your changes?

  • Pull down the branch
  • Build the branch
  • Run app dev with a theme app extension
  • Ensure navigating around localhost still works, and hot reload works and doesn't feel sluggish.

Post-release steps

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

@EvilGenius13 EvilGenius13 marked this pull request as ready for review April 2, 2026 17:48
@EvilGenius13 EvilGenius13 requested review from a team as code owners April 2, 2026 17:48
Copilot AI review requested due to automatic review settings April 2, 2026 17:48
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

We detected some changes at packages/*/src and there are no updates in the .changeset.
If the changes are user-facing, run pnpm changeset add to track your changes and include them in the next release CHANGELOG.

Caution

DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a debounce to the theme app extension file watcher to reduce excessive sync/reload activity when files change in rapid succession (matching the behavior already used for the main theme file watcher).

Changes:

  • Debounce add / change / unlink chokidar events in the theme extension filesystem watcher (250ms, per file + event type).
  • Add Vitest coverage verifying debounced behavior (single-fire, independent files, timer reset, event-type routing).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/theme/src/cli/utilities/theme-ext-environment/theme-ext-fs.ts Adds a per-file/per-event debounce queue before invoking update/delete handlers.
packages/theme/src/cli/utilities/theme-ext-environment/theme-ext-fs.test.ts Adds unit tests to ensure watcher events are debounced as expected.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants