Skip to content

Conversation

@zyyv
Copy link
Member

@zyyv zyyv commented Jan 9, 2026

fixed #5038

Copilot AI review requested due to automatic review settings January 9, 2026 12:48
@zyyv zyyv requested a review from antfu as a code owner January 9, 2026 12:48
@netlify
Copy link

netlify bot commented Jan 9, 2026

Deploy Preview for unocss ready!

Name Link
🔨 Latest commit 48750ff
🔍 Latest deploy log https://app.netlify.com/projects/unocss/deploys/6964ad9761b95400081a4302
😎 Deploy Preview https://deploy-preview-5054--unocss.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
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 fixes a race condition in watch mode by deferring cache clearing until after new data is populated. Previously, clearing the cache at the start of parseEntries could cause concurrent reads during async file operations to see an empty cache.

Key changes:

  • Changed cache update strategy from clear-then-populate to build-new-then-swap
  • Cache now remains valid throughout the async file reading operations

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

Comment on lines 122 to 124
cache.clear()
for (const [key, value] of newCache)
cache.set(key, value)
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

Consider adding a test that verifies the race condition fix by simulating concurrent access to the cache during watch mode updates. The test should ensure that the cache remains accessible with valid data while parseEntries is executing, particularly during the file reading operations between lines 99-105.

Copilot uses AI. Check for mistakes.
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 9, 2026

Open in StackBlitz

commit: 48750ff

@zyyv zyyv marked this pull request as draft January 12, 2026 03:09
@zyyv zyyv marked this pull request as ready for review January 12, 2026 08:30
@zyyv zyyv merged commit 6bf8941 into main Jan 12, 2026
12 checks passed
@zyyv zyyv deleted the fix-cli-test branch January 12, 2026 08:30
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