Add 'Generating layout…' indicator for large layouts - #9
Conversation
useGeneratorState exposes isGeneratingLayout, set true only when a worker layout request outlives a short grace period (LAYOUT_PENDING_DELAY_MS), so it appears for genuinely slow (large) layouts and never flickers on fast edits. The grace timer is cleared on resolve so a fast response can't light it after the fact. App renders a spinner pill over the preview while it's pending. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6f27bc7b0b
ℹ️ 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".
|
|
||
| @media (prefers-reduced-motion: reduce) { | ||
| .preview-generating__spinner { | ||
| animation-duration: 2s; |
There was a problem hiding this comment.
Disable the spinner for reduced-motion users
For users with prefers-reduced-motion: reduce, this still runs the spinner forever whenever a layout takes longer than the grace period; it only slows the rotation down. Because the text status already communicates progress and the spinner is decorative, the reduced-motion branch should stop the animation or replace it with a static indicator rather than leaving continuous motion enabled.
Useful? React with 👍 / 👎.
Adds a "Generating layout…" indicator that appears while the layout worker is producing a large layout, so the user gets feedback during a perceptible wait.
How it works
useGeneratorStateexposesisGeneratingLayout. When a worker layout request is issued, a grace timer (LAYOUT_PENDING_DELAY_MS = 150ms) is armed; the flag flips true only if the request is still pending after it. The timer is cleared on resolve, so a fast response never lights the indicator after the fact.Apprenders a small spinner pill over the preview (which keeps showing the previous layout) while pending. Respectsprefers-reduced-motion.Verification (in-browser)
pnpm typecheck✅ ·pnpm test(58) ✅ ·pnpm build✅🤖 Generated with Claude Code