Skip to content

Commit

Permalink
Fix issue #5343: [Bug]: Frontend changes cause Python unit tests work…
Browse files Browse the repository at this point in the history
…flow to fail but not frontend workflow
  • Loading branch information
openhands-agent committed Dec 1, 2024
1 parent afc94a2 commit 7ec381d
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 3 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/frontend-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Lint Frontend

on:
pull_request:
paths:
- 'frontend/**'
- '.github/workflows/frontend-lint.yml'
push:
branches:
- main
paths:
- 'frontend/**'
- '.github/workflows/frontend-lint.yml'

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json

- name: Install dependencies
run: cd frontend && npm ci

- name: Run TypeScript type checking
run: cd frontend && npx tsc --noEmit

- name: Run ESLint and Prettier
run: cd frontend && npm run lint
33 changes: 33 additions & 0 deletions .github/workflows/frontend-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Frontend Tests

on:
pull_request:
paths:
- 'frontend/**'
- '.github/workflows/frontend-test.yml'
push:
branches:
- main
paths:
- 'frontend/**'
- '.github/workflows/frontend-test.yml'

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json

- name: Install dependencies
run: cd frontend && npm ci

- name: Run TypeScript type checking
run: cd frontend && npx tsc --noEmit

- name: Run tests
run: cd frontend && npm run test
7 changes: 4 additions & 3 deletions frontend/src/components/chat-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ export function ChatInput({
};

const handleSubmitMessage = () => {
if (textareaRef.current?.value) {
onSubmit(textareaRef.current.value);
textareaRef.current.value = "";
const textarea = textareaRef.current;
if (textarea?.value) {
onSubmit(textarea.value);
textarea.value = "";
}
};

Expand Down

0 comments on commit 7ec381d

Please sign in to comment.