Skip to content

Fix WASM component render with initial terminal dimensions#244

Merged
LittleLittleCloud merged 2 commits intomainfrom
copilot/fix-wasm-reload-on-resize
Dec 6, 2025
Merged

Fix WASM component render with initial terminal dimensions#244
LittleLittleCloud merged 2 commits intomainfrom
copilot/fix-wasm-reload-on-resize

Conversation

Copy link
Contributor

Copilot AI commented Dec 6, 2025

WASM components rendered with hardcoded 80x150 dimensions regardless of actual terminal size, causing broken renders on narrower screens (e.g., mobile).

Changes

  • XTermPreview.tsx: Call fitAddon.fit() synchronously before registration; pass term.cols/term.rows to registerComponent
  • xtermConsole.ts / main.d.ts: Add cols, rows parameters to registerComponent signature
  • Program.cs: Forward dimensions to RazorConsoleRenderer constructor
  • RazorConsoleRenderer.cs: Use passed dimensions (with fallback defaults) instead of hardcoded values
// Before
await registerComponent(elementId);

// After
fitAddon.fit();
await registerComponent(elementId, term.cols, term.rows);
Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug]: website wasm component should be reloaded when xterm resize</issue_title>
<issue_description>### Description

xterm resize doesn't trigger a reload, which causes render bug on phone screen which width is narrower than the default width

Steps to Reproduce

Browse component on iphone

Expected Behavior

render correctly

Actual Behavior

render is brokne

Environment

No response

Additional Context

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

… component

Co-authored-by: LittleLittleCloud <16876986+LittleLittleCloud@users.noreply.github.com>
@github-actions
Copy link

github-actions bot commented Dec 6, 2025

🚀 Preview Deployment

A preview build has been generated for this PR from CI run #19982712135!

Download the artifact:
website-preview-244-48caaa5fbf70e80fbea57367fb3ec90ab5a415d5

To view the preview locally:

  1. Download the artifact from the CI workflow run
  2. Extract the ZIP file
  3. Serve the files with a local web server
    (e.g., npx serve dist)

🌐 Live Preview URL: https://067c1a3c.razorconsole.pages.dev

The live preview will be automatically updated when you push new
commits to this PR.

@github-actions
Copy link

github-actions bot commented Dec 6, 2025

🚀 Preview Deployment

A preview build has been generated for this PR from CI run #19982712135!

Download the artifact:
website-preview-244-48caaa5fbf70e80fbea57367fb3ec90ab5a415d5

To view the preview locally:

  1. Download the artifact from the CI workflow run
  2. Extract the ZIP file
  3. Serve the files with a local web server
    (e.g., npx serve dist)

🌐 Live Preview URL: https://366ea347.razorconsole.pages.dev

The live preview will be automatically updated when you push new
commits to this PR.

@LittleLittleCloud LittleLittleCloud marked this pull request as ready for review December 6, 2025 04:05
Copilot AI changed the title [WIP] Fix website wasm component reload on xterm resize Fix WASM component render with initial terminal dimensions Dec 6, 2025
@LittleLittleCloud LittleLittleCloud merged commit 143ae7a into main Dec 6, 2025
12 checks passed
@LittleLittleCloud LittleLittleCloud deleted the copilot/fix-wasm-reload-on-resize branch December 6, 2025 16:03
@github-actions github-actions bot added this to the v0.2.2 milestone Dec 6, 2025
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.

[Bug]: website wasm component should be reloaded when xterm resize

3 participants