Skip to content

feat(home): add search / filter for notes on the home page#105

Open
sricharan12-hub wants to merge 1 commit into
niharika-mente:mainfrom
sricharan12-hub:feature/homepage-note-search
Open

feat(home): add search / filter for notes on the home page#105
sricharan12-hub wants to merge 1 commit into
niharika-mente:mainfrom
sricharan12-hub:feature/homepage-note-search

Conversation

@sricharan12-hub

@sricharan12-hub sricharan12-hub commented Jul 2, 2026

Copy link
Copy Markdown

Overview

Adds a client-side search / filter to the home page so users can quickly
find notes as their collection grows, instead of scrolling the whole grid.

Closes #81

Changes

  • Add a searchQuery state and a controlled search <input> above the notes grid.
  • Derive filteredNotes from topLevelNotes using a case-insensitive substring
    match on title and content; render filteredNotes instead of topLevelNotes.
  • Add a clear (✕) button; clearing the input restores the full list.
  • Show a dedicated "No notes match your search" empty state when the query
    matches nothing — distinct from the existing NotesNotFound "no notes yet" state.
  • Style the input to match the existing Tailwind light/dark theme.

Filtering happens entirely on the client using the already-fetched notes, so no
backend changes are required.

Acceptance criteria

  • A search input is visible on the home page.
  • Typing filters notes by title and content, case-insensitively, in real time.
  • A clear "no matches" message is shown when the query matches nothing.
  • Clearing the input restores all notes.

Testing

  • npx eslint src/pages/HomePage.jsx passes with no errors.
  • Verified the JSX compiles (all modules transform in the Vite build).

Summary by CodeRabbit

  • New Features
    • Added note search and filtering on the home page.
    • Search now matches note titles and content, with a clear button and no-results message when nothing matches.

Add a controlled search input above the notes grid that filters
top-level notes by title and content using a case-insensitive
substring match, in real time as the user types.

- Introduce a searchQuery state and derive filteredNotes from
  topLevelNotes.
- Render filteredNotes instead of topLevelNotes.
- Show a dedicated "No notes match your search" empty state when the
  query matches nothing, distinct from the existing NotesNotFound
  "no notes yet" state.
- Add a clear (X) button; clearing the input restores the full list.
- Style the input to match the existing Tailwind light/dark theme.

Closes niharika-mente#81
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

HomePage.jsx adds client-side search/filtering of notes via a new searchQuery state and a derived filteredNotes list matching title/content case-insensitively. The rendered grid now uses filteredNotes, includes a search input with clear button, and shows a "no matches" empty state.

Changes

Home page search feature

Layer / File(s) Summary
Search state and filtering logic
frontend/src/pages/HomePage.jsx
Adds searchQuery state, lucide-react icon imports, and derived filteredNotes logic filtering top-level notes by case-insensitive substring match on title/content.
Search input and filtered rendering
frontend/src/pages/HomePage.jsx
Renders a search input with clear button, displays filteredNotes in the grid instead of topLevelNotes, and shows a "No notes match your search" empty state when nothing matches.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant SearchInput
  participant HomePage
  participant NoteCard

  User->>SearchInput: type query
  SearchInput->>HomePage: update searchQuery state
  HomePage->>HomePage: compute filteredNotes
  alt matches found
    HomePage->>NoteCard: render filteredNotes grid
  else no matches
    HomePage->>User: show "No notes match your search"
  end
Loading

Related issues: #81 — adds search/filter functionality for notes on the home page, matching the acceptance criteria of case-insensitive title/content filtering, a "no matches" empty state, and restoring full list on clear.

Suggested labels: enhancement, frontend

Suggested reviewers: niharika-mente

Poem:
A rabbit typed into a box so small,
Notes appeared and vanished, one and all,
Title, content, hidden no more,
Search reveals what scrolling once bore,
Clear the query — the whole list stands tall! 🐇🔍

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding note search and filtering on the home page.
Linked Issues check ✅ Passed The PR implements the requested client-side search, case-insensitive title/content filtering, clear action, and distinct no-match empty state.
Out of Scope Changes check ✅ Passed The changes stay focused on the home page search feature and related UI imports, with no unrelated scope creep.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Warning

⚠️ This pull request shows signs of AI-generated slop (phantom_api). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
frontend/src/pages/HomePage.jsx (2)

33-42: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Search scope silently excludes notes nested inside groups.

filteredNotes filters topLevelNotes, so a note with a groupId (i.e., grouped inside another note) is never matched even if its title/content contains the query — only the group container's own title/content is searchable. This is consistent with the existing top-level-only grid, but users may expect search to surface any matching note regardless of grouping.

Consider deciding explicitly whether search should also match grouped/child notes (and surface their parent group if so) or document this as intended scope.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/pages/HomePage.jsx` around lines 33 - 42, The search logic in
HomePage currently filters only topLevelNotes, so grouped/child notes are never
matched even when their own title or content fits the query. Update the
filtering flow around filteredNotes in HomePage.jsx to either explicitly keep
top-level-only behavior with a clear comment/documentation, or expand the search
to inspect grouped notes as well and surface the matching note or its parent
group consistently. Make the intended scope explicit in the search/filter
implementation.

161-217: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Search input, clear button, and empty state look correct.

Controlled input, clear button, and the distinct "no matches" empty state (separate from NotesNotFound) all align with the PR objective. Accessibility labels (aria-label) are present on both the input and clear button.

One minor note: filteredNotes is recomputed on every render rather than memoized with useMemo. Given typical note counts this is unlikely to matter in practice, but could be revisited if the notes list grows large.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/pages/HomePage.jsx` around lines 161 - 217, `HomePage`
recomputes `filteredNotes` on every render, which can be avoided for better
scalability. Move the filtering logic into a `useMemo` in `HomePage.jsx` so the
derived list only recalculates when `notes` or `searchQuery` changes, and keep
the existing `filteredNotes.map(...)` rendering unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@frontend/src/pages/HomePage.jsx`:
- Around line 33-42: The search logic in HomePage currently filters only
topLevelNotes, so grouped/child notes are never matched even when their own
title or content fits the query. Update the filtering flow around filteredNotes
in HomePage.jsx to either explicitly keep top-level-only behavior with a clear
comment/documentation, or expand the search to inspect grouped notes as well and
surface the matching note or its parent group consistently. Make the intended
scope explicit in the search/filter implementation.
- Around line 161-217: `HomePage` recomputes `filteredNotes` on every render,
which can be avoided for better scalability. Move the filtering logic into a
`useMemo` in `HomePage.jsx` so the derived list only recalculates when `notes`
or `searchQuery` changes, and keep the existing `filteredNotes.map(...)`
rendering unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 985b80f4-12bf-497c-ae50-89689366fcc3

📥 Commits

Reviewing files that changed from the base of the PR and between 87148ba and f60bed6.

📒 Files selected for processing (1)
  • frontend/src/pages/HomePage.jsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add search / filter for notes on the home page

1 participant