Skip to content

⚡ Bolt: Defer expensive rubric calculations during text streaming#47

Open
aloewright wants to merge 2 commits into
mainfrom
bolt-defer-rubric-scoring-732201737328956941
Open

⚡ Bolt: Defer expensive rubric calculations during text streaming#47
aloewright wants to merge 2 commits into
mainfrom
bolt-defer-rubric-scoring-732201737328956941

Conversation

@aloewright

Copy link
Copy Markdown
Owner

💡 What: Wrapped the visibleOutput state in useDeferredValue before passing it to analyzeText inside useMemo in the playground view. Added comments explaining the purpose.

🎯 Why: The playground view simulates text streaming by slicing and updating visibleOutput every 24ms. Synchronously running analyzeText and scoreDeterministic on every tick of a long output can block the main thread and cause jitter in the streaming animation.

📊 Impact: Reduces main-thread blocking during fake text streaming. React will now defer the expensive analysis calculations to a lower-priority render phase, dropping intermediate frames if necessary, ensuring the text streaming animation remains smooth.

🔬 Measurement: Verify by running the playground text generation against a long output stream and profiling the main thread—there should be fewer long tasks caused by analyzeText during the streaming phase.


PR created automatically by Jules for task 732201737328956941 started by @aloewright

Co-authored-by: aloewright <3641844+aloewright@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 27, 2026 06:03
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@aloewright, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 19 minutes and 23 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 34abc43c-68ce-47e4-a7a1-9226b76059c2

📥 Commits

Reviewing files that changed from the base of the PR and between bab8f67 and caec414.

📒 Files selected for processing (2)
  • .jules/bolt.md
  • apps/quill/client/components/playground-view.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bolt-defer-rubric-scoring-732201737328956941

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 27, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
postpilot caec414 May 27 2026, 06:19 AM

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces performance optimizations to prevent UI blocking during rapid text streaming in the playground view. It adds a markdown documentation file explaining the issue and uses React's useDeferredValue to defer expensive text analysis and scoring computations. The reviewer suggests deriving an isStale state by comparing the current and deferred output values to visually indicate to the user when the displayed analysis results are out-of-sync with the latest text.

Comment on lines +261 to +262
const deferredOutput = useDeferredValue(visibleOutput);
const snapshot = useMemo(() => analyzeText(deferredOutput), [deferredOutput]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

When using useDeferredValue to defer expensive computations during rapid state updates (like text streaming), the UI can display a temporary mismatch between the latest streamed text (visibleOutput) and the deferred analysis results (snapshot, score).

To prevent user confusion, it is a recommended UX best practice to visually indicate when the deferred calculations are stale (out-of-sync with the current text). You can derive this state by comparing the current and deferred values, and then use it to apply a visual treatment (such as reducing the opacity of the <RubricSnapshot /> container or showing a subtle loading indicator) while the background calculation is pending.

  const deferredOutput = useDeferredValue(visibleOutput);
  const isStale = visibleOutput !== deferredOutput;
  const snapshot = useMemo(() => analyzeText(deferredOutput), [deferredOutput]);

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1187733e10

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +261 to +262
const deferredOutput = useDeferredValue(visibleOutput);
const snapshot = useMemo(() => analyzeText(deferredOutput), [deferredOutput]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid showing stale rubric data during streams

Because the rubric is still rendered whenever visibleOutput.length > 0 below, switching the calculation to deferredOutput lets the UI show a non-empty output with a snapshot from the previous deferred value. This happens at the start of a first stream (zeros can be shown while text is already visible) and especially when running again after a previous result, where the old result's score/details can remain visible until the deferred render catches up. The snapshot display should be gated off the same deferred value or indicate it is stale while deferredOutput !== visibleOutput.

Useful? React with 👍 / 👎.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Co-authored-by: aloewright <3641844+aloewright@users.noreply.github.com>
@aloewright aloewright enabled auto-merge (squash) June 4, 2026 05:06
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