Skip to content

Conversation

@chenjiahan
Copy link
Member

Summary

In the previous implementation, we had already prevented the same browser error log from being output consecutively: #6263.

This PR further enhances browser log deduplication by ensuring that identical logs are not repeated within the same build. After a rebuild, these logs can be output again.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings September 29, 2025 07:27
@netlify
Copy link

netlify bot commented Sep 29, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 7e20128
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/68da35ab4ce7820008490bb7
😎 Deploy Preview https://deploy-preview-6283--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 51 (🔴 down 15 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

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 implements enhanced deduplication for browser error logs by tracking reported logs within a build session and preventing duplicate outputs. The enhancement goes beyond the previous consecutive duplicate prevention to eliminate all duplicate logs within the same build cycle.

  • Refactors browser log processing to separate formatting from reporting responsibilities
  • Adds build-scoped deduplication using a Set to track reported error logs
  • Clears the deduplication cache after each build to allow logs to appear again in subsequent builds

Reviewed Changes

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

Show a summary per file
File Description
packages/core/src/server/socketServer.ts Implements the main deduplication logic with a Set to track reported logs and clears it on build completion
packages/core/src/server/browserLogs.ts Refactors the error reporting function to only format messages and return strings instead of directly logging
packages/core/src/server/assets-middleware/index.ts Updates method name from updateStats to onBuildDone to better reflect its purpose
e2e/cases/browser-logs/dedupe-log/src/index.js Updates test error message format for better test validation
e2e/cases/browser-logs/dedupe-log/index.test.ts Enhances test to verify deduplication works within builds and logs reappear after rebuilds

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@chenjiahan chenjiahan merged commit 24cf767 into main Sep 29, 2025
11 checks passed
@chenjiahan chenjiahan deleted the browser_logs_dedupe_0929 branch September 29, 2025 08:01
@chenjiahan chenjiahan mentioned this pull request Sep 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants