Guard initial fit sizing

This commit is contained in:
GitHub Copilot
2026-01-27 23:34:55 +00:00
parent cb6ea35c94
commit 2477491fa0
3 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "textual-webterm" name = "textual-webterm"
version = "0.3.22" version = "0.3.23"
description = "Serve terminal sessions over the web" description = "Serve terminal sessions over the web"
authors = ["Will McGugan <will@textualize.io>"] authors = ["Will McGugan <will@textualize.io>"]
license = "MIT" license = "MIT"
File diff suppressed because one or more lines are too long
+7 -1
View File
@@ -190,7 +190,13 @@ class WebTerminal {
const maxAttempts = 120; const maxAttempts = 120;
const attemptFitAndResize = (attempt: number) => { const attemptFitAndResize = (attempt: number) => {
const dims = this.fitAddon.proposeDimensions(); const dims = (() => {
try {
return this.fitAddon.proposeDimensions();
} catch {
return undefined;
}
})();
if (!dims) { if (!dims) {
if (attempt < maxAttempts) { if (attempt < maxAttempts) {
window.requestAnimationFrame(() => attemptFitAndResize(attempt + 1)); window.requestAnimationFrame(() => attemptFitAndResize(attempt + 1));