Skip to content

Add 'Generating layout…' indicator for large layouts - #9

Merged
YurMil merged 1 commit into
mainfrom
feat/layout-progress-indicator
Jul 17, 2026
Merged

Add 'Generating layout…' indicator for large layouts#9
YurMil merged 1 commit into
mainfrom
feat/layout-progress-indicator

Conversation

@YurMil

@YurMil YurMil commented Jul 17, 2026

Copy link
Copy Markdown
Owner

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

  • useGeneratorState exposes isGeneratingLayout. 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.
  • This makes it time-based and machine-adaptive: it shows exactly when there's a real wait (large layouts / slower clients) and stays silent on ordinary fast edits.
  • App renders a small spinner pill over the preview (which keeps showing the previous layout) while pending. Respects prefers-reduced-motion.

Verification (in-browser)

  • Large near-cap layout (52,471 points) → indicator shown (screenshotted) and auto-cleared on resolve.
  • Warm small edits (100–200 points) → indicator never shown across sampled offsets.
  • Fixed a subtle bug found during verification: the grace timer wasn't cleared on resolve, so fast layouts lit the indicator 150 ms after finishing — now cleared on resolve.
  • pnpm typecheck ✅ · pnpm test (58) ✅ · pnpm build

🤖 Generated with Claude Code

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>
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@YurMil
YurMil merged commit 0f848a7 into main Jul 17, 2026
2 checks passed
@YurMil
YurMil deleted the feat/layout-progress-indicator branch July 17, 2026 17:14

@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: 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".

Comment thread src/styles.css

@media (prefers-reduced-motion: reduce) {
.preview-generating__spinner {
animation-duration: 2s;

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 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 👍 / 👎.

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.

1 participant