Skip to content

feat: poll git state for live reload instead of watching files - #471

Open
rafaelsteil wants to merge 2 commits into
yoshiko-pg:mainfrom
rafaelsteil:raf-poll-git-state
Open

rafaelsteil wants to merge 2 commits into
yoshiko-pg:mainfrom
rafaelsteil:raf-poll-git-state

Conversation

@rafaelsteil

@rafaelsteil rafaelsteil commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Replace @parcel/watcher filesystem watching with git-state polling for live reload
  • Scope each poll to the git state the current diff mode can actually show (HEAD only, index, or worktree)
  • Drop the native watcher dependency from the CLI and the VS Code extension (including the per-platform binary download in the extension build)

@parcel/watcher walked the whole tree at startup (globs in ignore do not prune the walk). On a large monorepo that dominated boot (~30s for the watcher alone). Polling git is cheaper, and git rev-parse --git-dir replaces a full git status in validateCommit for the same "am I in a repo?" check.

Test plan

  • pnpm check / pnpm test / pnpm build pass
  • Working/dot mode: edit a tracked file while difit is open and the browser reloads within a couple of seconds
  • Default (HEAD) mode: uncommitted edits do not trigger a reload; creating a commit does
  • Staged mode: staging a change reloads; an unstaged-only edit does not
  • Specific commit comparison does not poll
  • Closing the last browser tab stops polling; opening a tab starts it again
  • VS Code extension still packages and opens a diff without @parcel/watcher

@parcel/watcher walked the whole tree at startup and dominated boot on large repos. Polling git is cheaper, scopes reloads by diff mode, and drops the native dependency from the CLI and VS Code extension.
git status --porcelain reports only status letters, so a file that is
already dirty kept the same signal after every later edit. Hash the
patch instead so the poller fires whenever the rendered diff changes.

This branch has not been deployed

No deployments
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.

1 participant