Skip to content

fix: regenerate indexes before restarting watch processes - #107

Open
RomainLanz wants to merge 1 commit into
8.xfrom
fix/watcher-index-regeneration-order
Open

fix: regenerate indexes before restarting watch processes#107
RomainLanz wants to merge 1 commit into
8.xfrom
fix/watcher-index-regeneration-order

Conversation

@RomainLanz

Copy link
Copy Markdown
Member

Hey! 👋

When a file is added or removed in watch mode, DevServer and TestRunner start regenerating the generated indexes and immediately restart the server or re-run the tests.

Since IndexGenerator.addFile and IndexGenerator.removeFile are asynchronous, the new process may read a stale index. After a removal, that stale index may still import the deleted file.

This PR waits for index regeneration before restarting the server or re-running the tests. The existing public hook order and HMR behavior remain unchanged.

The tests use a controlled promise to verify the ordering without relying on arbitrary timeouts.

Was there a reason for intentionally not awaiting these IndexGenerator calls? Happy to adjust the change if the fire-and-forget behavior was required.

Tests

  • Targeted DevServer and TestRunner watcher tests
  • Existing HMR and watch index regeneration tests
  • npm run typecheck
  • npm run lint

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