Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/chat-app/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function parseBlocks(text: string): Block[] {
}

// ── Handle Paragraphs ────────────────────────
if (line.trim() === '') {
if (line.trim().length === 0) {
blocks.push({
type: 'paragraph',
text: '',
Expand Down
2 changes: 1 addition & 1 deletion examples/showcase/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class ShowcaseApp extends Widget {
if (event.key === 'q' || (event.ctrl && event.key === 'c')) return false;

// Tab switching: 1-5
const num = parseInt(event.key);
const num = parseInt(event.key, 10);
if (num >= 1 && num <= 5) {
this.switchTab(num - 1);
return true;
Expand Down
2 changes: 1 addition & 1 deletion examples/weather/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ async function fetchWeather() {
}
}

setInterval(fetchWeather, 5000);
clearInterval(window.__interval); window.__interval = setInterval(fetchWeather, 5000);
fetchWeather();

// Gauge does not expose a public setColor() method, so dynamic color
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/Form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,5 @@ export class Form extends Widget {
}
}
}

.catch(err => console.error("Promise.all failed:", err));
Comment on lines +141 to +142

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Attach the rejection handler to Promise.all.

Line 142 starts with .catch(...) as a standalone expression. This is invalid TypeScript syntax, so packages/ui/src/Form.ts cannot compile. Wrap the await Promise.all(validationPromises) call in try/catch or attach .catch directly to that expression. When validation rejects, reset _isValidating and call markDirty() before returning.

Suggested structure
-const results = await Promise.all(validationPromises);
+try {
+    const results = await Promise.all(validationPromises);
+    // Keep the existing result-processing logic inside this block.
+} catch (err) {
+    console.error('Promise.all failed:', err);
+    this._isValidating = false;
+    this.markDirty();
+    return;
+}
...
-.catch(err => console.error("Promise.all failed:", err));
🧰 Tools
🪛 Biome (2.5.5)

[error] 142-142: Expected a statement but instead found '.catch(err => console.error("Promise.all failed:", err))'.

(parse)

🪛 GitHub Actions: CI / 0_build-and-test.txt

[error] 142-142: Build failed during 'tsup' because of an unexpected '.' at the start of the '.catch(err => console.error("Promise.all failed:", err));' statement.

🪛 GitHub Actions: CI / build-and-test

[error] 142-142: Build failed in the tsup step: Unexpected '.' at the start of the catch call. Command 'bun run build' exited with code 1.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ui/src/Form.ts` around lines 141 - 142, Fix the validation flow in
Form by attaching the rejection handler directly to the Promise.all call or
wrapping await Promise.all(validationPromises in try/catch; on rejection, reset
_isValidating, call markDirty(), and return, while preserving the successful
validation path.

Source: Linters/SAST tools

Loading