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/ai-streaming/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class AIStreamingApp extends Widget {
this.addChild(this._toolCall);
this.addChild(this._streamingText);

setInterval(() => {
clearInterval(window.__interval); window.__interval = setInterval(() => {
this._streamingText.tick();
}, 50);
}
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

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

bunx biome check packages/ui/src/Form.ts
rg -n -C 8 'Promise\.all|Promise\.all failed|\.catch' packages/ui/src/Form.ts

Repository: Karanjot786/TermUI

Length of output: 198


🏁 Script executed:

<scratchpad_start>
[task review_file_1/1 verify_comment_1/2]
[observations]
- Initial execution failed because `bunx` is not available in the sandbox.
[analysis]
- Need inspect `packages/ui/src/Form.ts` around the reported lines and surrounding method.
[pending]
- Determine source syntax shape around `Promise.all` and `.catch`.
- Determine whether parsing concern and validation-state cleanup concern hold.
[actions]
- Read relevant sections of `packages/ui/src/Form.ts`.
- Use a read-only static parser/TypeScript compiler diagnostic if available.
[done]
[scratchpad_end] -->

Repository: Karanjot786/TermUI

Length of output: 250


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "== file exists and size =="
wc -l packages/ui/src/Form.ts

echo "== relevant submit section =="
sed -n '60,155p' packages/ui/src/Form.ts

echo "== search validators/promises =="
rg -n -C 4 'isValidating|submit|Promise\.all|\.catch|markDirty' packages/ui/src/Form.ts

echo "== static parser diagnostics if typescript available =="
if command -v tsc >/dev/null 2>&1; then
  tsc --noEmit --strict packages/ui/src/Form.ts || true
else
  echo "tsc not available"
fi
if command -v node >/dev/null 2>&1; then
  node - <<'JS' || true
const {parse} = require('`@typescript-eslint/parser`');
const fs = require('node:fs');
try {
  parse(fs.readFileSync('packages/ui/src/Form.ts','utf8'), {ecmaVersion: 2024, sourceType: 'module'});
  console.log('typescript-eslint parser: ok');
} catch (e) {
  console.log(e && e.message);
}
JS
fi

Repository: Karanjot786/TermUI

Length of output: 8398


Remove the dangling .catch after Form.

packages/ui/src/Form.ts:142 is outside the Form class body and is not attached to an expression, so the file is invalid TypeScript. If validation rejection handling is needed, wrap the await Promise.all(validationPromises) call inside submit() and reset _isValidating / call markDirty() in a finally block.

🧰 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: The @termuijs/ui build failed during 'tsup' because '.catch(err => console.error("Promise.all failed:", err));' is syntactically unexpected. TypeScript also reports missing try, closing parenthesis, and semicolon tokens.

🪛 GitHub Actions: CI / build-and-test

[error] 142-142: The @termuijs/ui build command 'tsup' failed due to an unexpected '.' in '.catch(err => console.error("Promise.all failed:", err));'. TypeScript also reported declaration/statement and syntax errors on this line.

🤖 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, Remove the dangling .catch
after the Form class. In Form.submit(), handle rejection from await
Promise.all(validationPromises) within the method and use finally to reset
_isValidating and call markDirty() when validation handling is required.

Sources: Coding guidelines, Linters/SAST tools

Loading