Skip to content

FE-778: Dim the code editor loading label and left-align it inline - #9628

Merged
kube merged 4 commits into
mainfrom
claude/fe-778-code-editor-loading-placeholder
Sep 10, 2026
Merged

FE-778: Dim the code editor loading label and left-align it inline#9628
kube merged 4 commits into
mainfrom
claude/fe-778-code-editor-loading-placeholder

Conversation

@kube

@kube kube commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Before this PR, a code editor showed a full-strength "Loading..." label while Monaco loaded, centered in the box. In an inline expression cell the centered label jumped to the left once the editor mounted, and in both shapes it read as content rather than as a wait.

Both placeholders now share one dimmed element: left-aligned and vertically centered in an inline editor, centered in a block editor. Monaco's own loading state renders the same element, so the label does not change between the module load and the editor mount.

Before

9628-before.mp4

After

9628-after.mp4

Links

Changes

  • One loading element for both waits

    CodeEditor passes its Suspense fallback to Monaco's loading prop, so the module load and the editor mount show the same label.

  • Inline label sits at the left, block label stays centered

    Both fill their box and render at 0.3 opacity.

Review fixes

  • Placeholder waits for the editor mount

    Monaco's loading label and the inline placeholder sat at the same inset until the editor mounted; the placeholder now renders only after onMount.

Test coverage

  • Existing @hashintel/petrinaut unit suite
  • code-editor.test.tsx:

    The inline placeholder is absent while a stand-in editor shows its loading label and appears once it mounts.

How to test

  • Open Petrinaut preview on Vercel
  • Menu > Load example > SIR Epidemic Model
  • Throttle the network in the developer tools
  • Select a transition, open its lambda code

    Expect a dimmed centered "Loading..." label until the editor mounts

  • Viewport controls > Settings > General > Ad-hoc scenarios
  • Bottom bar > diagnostics > Simulation Settings tab, open a place's count cell

    Expect a dimmed "Loading..." label at the left of the cell until the editor mounts

The label shown while Monaco loads is one dimmed element for both waits,
the module load and the editor mount: left-aligned and vertically centred
in an inline expression cell, where a centred label used to jump to the
left once the editor mounted, and centred in a block editor.
@kube kube self-assigned this Sep 9, 2026
@vercel

vercel Bot commented Sep 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hash Ready Ready Preview Sep 9, 2026 5:07pm UTC
petrinaut Ready Ready Preview Sep 9, 2026 5:07pm UTC
petrinaut-docs Ready Ready Preview Sep 9, 2026 5:07pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
hashdotdesign-tokens Ignored Ignored Preview Sep 9, 2026 5:07pm UTC

Request Review

@github-actions github-actions Bot added area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team labels Sep 9, 2026
@kube
kube marked this pull request as ready for review September 9, 2026 12:26
@kube
kube requested review from YannisZa, drdma and vilkinsons and a balanced review from Copilot and removed request for Copilot September 9, 2026 12:26
@cursor

cursor Bot commented Sep 9, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
UI-only loading/placeholder timing and styling in the Monaco wrapper, covered by a new unit test.

Overview
Improves how Petrinaut’s CodeEditor looks while Monaco is still loading, so the wait state doesn’t read like real content or jump when the editor appears.

Loading label: Suspense fallback and Monaco’s loading prop now share the same element (loading={fallback}), styled at 0.3 opacity and full width. Block editors keep a centered label; single-line editors use a left-aligned label at the same inset as typed text (12px), avoiding the old center-to-left jump.

Placeholder: Inline placeholders render only after onMount (editorMounted), so they no longer stack on top of Monaco’s loading label at the same position.

Tests: New code-editor.test.tsx asserts the placeholder is hidden during fake editor loading and visible after mount.

Reviewed by Cursor Bugbot for commit bdad29b. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8ba14ed. Configure here.

Comment thread libs/@hashintel/petrinaut/src/ui/monaco/code-editor.tsx
Copilot AI balanced review requested due to automatic review settings September 9, 2026 13:26

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.

🟢 Approval recommended

The focused styling and lifecycle changes are consistent, covered by a targeted test, and include the required changeset.

Pull request overview

Updates Petrinaut’s Monaco editor loading state for smoother, clearer presentation.

Changes:

  • Shares one loading element across module loading and editor mounting.
  • Dims loading labels and left-aligns inline-editor labels.
  • Tests placeholder visibility during mounting.
  • Relevant user docs do not describe loading presentation, so no update is needed.
File summaries
File Description
code-editor.tsx Updates loading styles and mount-state handling.
code-editor.test.tsx Tests loading-to-placeholder behavior.
.changeset/code-editor-loading-label.md Adds the required patch changeset.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions github-actions Bot removed the area/infra Relates to version control, CI, CD or IaC (area) label Sep 9, 2026
@kube
kube added this pull request to the merge queue Sep 10, 2026
Merged via the queue into main with commit 82cb19f Sep 10, 2026
71 checks passed
@kube
kube deleted the claude/fe-778-code-editor-loading-placeholder branch September 10, 2026 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

3 participants