feat(preview-server): buffer console logs until spinner is done#2725
Merged
gabrielmfern merged 7 commits intocanaryfrom Dec 12, 2025
Merged
feat(preview-server): buffer console logs until spinner is done#2725gabrielmfern merged 7 commits intocanaryfrom
gabrielmfern merged 7 commits intocanaryfrom
Conversation
🦋 Changeset detectedLatest commit: 9520b08 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
Contributor
There was a problem hiding this comment.
1 issue found across 2 files
Prompt for AI agents (all 1 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/preview-server/src/actions/render-email-by-path.tsx">
<violation number="1" location="packages/preview-server/src/actions/render-email-by-path.tsx:76">
P1: Race condition: concurrent calls to `renderEmailByPath` can corrupt global console methods. When a second call starts before the first finishes, it captures the buffered function as `original` instead of the real console method. Consider storing the original console methods once at module scope, or using a reference counter to only restore when all concurrent calls complete.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
399acd0 to
165137f
Compare
73c5a3d to
9ef09e4
Compare
joaopcm
approved these changes
Dec 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've always been annoyed at the fact that
ora's spinners conflict with console.log statements during rendering, which sometimes, ends up eating away what you wanted to see in a console.log statement. To fix this, I've tried usingprocess.stdout.corkanduncork, butconsole.errandconsole.warnwrite toprocess.stderrwhich is where ora also writes to, and corking will also buffer the spinner itself, which we don't want.So, this just replaces the global console functions, storing the arguments to pass to the log function, and then once the spinner is done sends it all into the original function.
2025-12-12.18-06-45.mp4
2025-12-12.18-04-47.mp4
Summary by cubic
Prevents spinner output from overwriting console logs in the preview server by buffering logs during rendering and flushing them after the spinner stops.
New Features
Bug Fixes
Written for commit 9520b08. Summary will update automatically on new commits.