-
Notifications
You must be signed in to change notification settings - Fork 1.5k
add frontend for search #513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add frontend for search #513
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-app | 0f15ae1 | Oct 23 2025, 05:09 AM |
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite. How to use the Graphite Merge QueueAdd the label Main to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Code Review: Add Frontend for SearchThank you for adding the search frontend! Here's my review of the changes: ✅ Strengths
🔴 Critical Issues1. Performance Issue - Fetch on Every Keystroke (graphite-demo/frontend.jsx:9-26) The current implementation triggers a fetch request on every single keystroke since
Recommendation: Implement debouncing to delay the search until the user stops typing: import React, { useEffect, useState } from 'react';
const TaskSearch = () => {
const [tasks, setTasks] = useState([]);
const [loading, setLoading] = useState(false);
const [error, setError] = useState(null);
const [searchQuery, setSearchQuery] = useState('');
useEffect(() => {
// Don't fetch on mount with empty query
if (!searchQuery.trim()) {
setTasks([]);
setLoading(false);
return;
}
setLoading(true);
setError(null);
// Debounce: wait 300ms after user stops typing
const timeoutId = setTimeout(() => {
fetch(`/search?query=${encodeURIComponent(searchQuery)}`)
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
setTasks(data);
setLoading(false);
})
.catch(error => {
setError(error.message);
setLoading(false);
});
}, 300);
return () => clearTimeout(timeoutId);
}, [searchQuery]);
// Rest of component...
};2. Initial Fetch on Mount (graphite-demo/frontend.jsx:9-26) The component immediately fetches with an empty search query on mount, which may not be the desired behavior. Consider:
|
3178305 to
cf5fd1d
Compare
8882752 to
0f15ae1
Compare
PR Review: Add Frontend for SearchOverviewThis PR adds a React frontend component to complement the search API from PR #512. Overall structure is good, but there are several issues that need to be addressed before merging. 🐛 Critical Issues1. Infinite Loop on Initial Load (graphite-demo/frontend.jsx:10)The Issue: useEffect(() => {
setLoading(true);
fetch(`/search?query=${encodeURIComponent(searchQuery)}`)
// ...
}, [searchQuery]);Recommendation: useEffect(() => {
if (!searchQuery) {
setTasks([]);
setLoading(false);
return;
}
const timeoutId = setTimeout(() => {
setLoading(true);
fetch(`/search?query=${encodeURIComponent(searchQuery)}`)
// ... rest of fetch logic
}, 300); // 300ms debounce
return () => clearTimeout(timeoutId);
}, [searchQuery]);2. Missing Key Prop Uniqueness Guarantee (graphite-demo/frontend.jsx:46)Using
|
Pull Request Review - Frontend Search ComponentThank you for the contribution! Here is my detailed review: Code Quality - Positive Aspects
Areas for Improvement1. Debouncing the search 2. Initial empty search 3. Missing cleanup Potential Bugs
Performance Considerations
Security ConcernsEnsure the /search endpoint has proper authentication using Better Auth or API key authentication as per project standards. Code Style & Repository Standards
Test CoverageMissing: unit tests, error state tests, loading state tests, and integration tests with the search API. Summary Recommendations
Overall, this is a good foundation but needs refinement for production use. Main concerns are performance optimization and alignment with project standards. Review generated by Claude Code |

No description provided.