Repository navigation
chore: add required auth dialog for playground canvas - #2307
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe canvas page client extracts prompt input into a memoized component, integrates authentication dialog rendering, refactors generation to accept a prompt with abortable streaming and incremental compilation, and adds memoized spec-derived values for JSON UI provider key. ChangesCanvas Page Client Refactoring
🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/playground/src/components/playground/canvas-page-client.tsx`:
- Around line 212-224: handleStop currently sets setIsGenerating(false) and
clears abortRef.current too early; move generation cleanup into the request's
finally and guard against clearing a newer request: create a local controller
from abortRef.current at start of handleGenerate (the fetch block), perform all
cleanup (setIsGenerating(false) and abortRef.current = null) inside the fetch's
finally, and before clearing abortRef.current verify that abortRef.current ===
localController so you don't clear a later request; update other similar blocks
(lines noted around 288-290 and 296-299) to use the same pattern and only let
the finally block own toggling setIsGenerating and nulling abortRef.current.
- Around line 93-97: The prompt state is kept inside CanvasPromptInput so parent
resets don't clear it; make the prompt controlled by lifting state or forcing
CanvasPromptInput to reset: change CanvasPromptInput to accept value and
onChange props (bind to parent prompt/setPrompt used in canvas-page-client where
prompt, setPrompt and handleSubmit exist) or add a reset/key prop from the
parent reset/new-canvas flow so the parent can clear prompt by setting prompt=""
or changing the key; ensure handleSubmit still calls onGenerate(prompt) from the
parent-controlled prompt.
- Around line 264-279: The final completion branch currently assigns the
compiled spec unconditionally and the JSON fallback silently ignores invalid
shapes; update the completion handling in the compileSpecStream try/catch so
that after obtaining compiled (from compileSpecStream) you validate its shape
(e.g., compiled.root and compiled.elements) before calling setSpec and
setEditorValue, and if validation fails setParseError("Failed to parse AI
response as a valid spec"); likewise, in the JSON.parse fallback (parsed) apply
the same shape guard and setParseError when the parsed object is not a valid
Spec, using the same functions (compileSpecStream, specStreamBuffer, compiled,
parsed, setSpec, setEditorValue, setParseError) to locate and modify the logic.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 562e33ff-9b59-4431-8115-836bad396eea
📒 Files selected for processing (1)
apps/playground/src/components/playground/canvas-page-client.tsx
Summary by CodeRabbit
New Features
Refactor
Bug Fixes