-
-
Notifications
You must be signed in to change notification settings - Fork 19
feat: add client-side search to journal entries #30
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
base: main
Are you sure you want to change the base?
Conversation
…e OPENMINDWELL_PROJECT_GUIDE.md to Project_Guide.md, and fix typo 'deatailed' to 'detailed' Co-authored-by: Cosine <agent@cosine.sh>
docs: fix README references, clone URL, and typo
… handling Co-authored-by: Cosine <agent@cosine.sh>
|
kindly rebase your commit history! |
Blazzzeee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please dont use useEffect for this , you should check on tanstack query and mutations
| const [searchQuery, setSearchQuery] = useState(''); | ||
|
|
||
| useEffect(() => { | ||
| let isMounted = true; | ||
|
|
||
| async function loadEntries() { | ||
| try { | ||
| const data = await journalApi.getAll(); | ||
| if (!isMounted) return; | ||
| setEntries(Array.isArray(data) ? data : []); | ||
| } catch (err) { | ||
| console.error('Error loading journal entries:', err); | ||
| if (!isMounted) return; | ||
| setError('Failed to load journal entries.'); | ||
| } finally { | ||
| if (!isMounted) return; | ||
| setLoading(false); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useEffect should only be used for external dependency sync , not render , please change this
Adds a minimal client-side search to the Journal tab so users can quickly filter entries by title or content (case-insensitive).
No backend changes.
Closes #14
Type of Change
🐛 Bug fix
✨ New feature
💥 Breaking change
📚 Documentation update
🧹 Code refactoring
⚡ Performance improvement
✅ Test improvement
🔧 Build or CI/CD configuration changes
How Has This Been Tested?
Open Dashboard → Journal tab
Entries load correctly
Typing in search filters instantly (title OR content)
Case-insensitive
Clearing search shows all entries
Loading, empty state, and “no results” states verified
Screenshots
N/A (small UI addition only)
Checklist
My code follows the style guidelines of this project
I have performed a self-review of my own code
I have commented my code, particularly in hard-to-understand areas
I have made corresponding changes to the documentation
My changes generate no new warnings
I have 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 and published in downstream modules
Additional Information
Frontend-only change.
Only frontend/src/pages/Dashboard.tsx modified.
No new dependencies.
Learning Outcomes
Improved understanding of client-side filtering and React state management.