Compare commits

...

1 Commits

3 changed files with 70 additions and 3 deletions

33
.github/workflows/frontend-lint.yml vendored Normal file
View File

@@ -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
.github/workflows/frontend-test.yml vendored Normal file
View File

@@ -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

View File

@@ -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 = "";
}
};