-
-
Notifications
You must be signed in to change notification settings - Fork 232
feat: implement deduplication for browser error logs #6283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for rsbuild ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this 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.

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