Skip to content

Commit

Permalink
fix(frontend): unable multiple enter on search page (#2074)
Browse files Browse the repository at this point in the history
# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged

## Screenshots (if appropriate):
  • Loading branch information
Zewed authored Jan 23, 2024
1 parent b11147d commit ddc5cdd
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions frontend/lib/components/ui/SearchBar/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ export const SearchBar = (): JSX.Element => {
}, [setCurrentBrainId, message]);

const submit = async (): Promise<void> => {
setSearching(true);
setMessages([]);
try {
await addQuestion(message);
} catch (error) {
console.error(error);
} finally {
setSearching(false);
if (!searching) {
setSearching(true);
setMessages([]);
try {
await addQuestion(message);
} catch (error) {
console.error(error);
} finally {
setSearching(false);
}
}
};

Expand Down

0 comments on commit ddc5cdd

Please sign in to comment.