Skip to content

Conversation

Copy link

Copilot AI commented Dec 11, 2025

Implements real-time search filtering for tasks by title and description with URL state persistence.

Changes

Server Action

  • Added searchTasks in actions.ts with case-insensitive Prisma query on name and description fields
  • Returns all tasks when query is empty or <3 characters

Client Components

  • Created TasksPageClient with search input, controlled state, and URL sync via pushState
  • Added EmptyState UI primitive (Radix-style with CVA) for zero-results display
  • Updated tasks/page.tsx to server-render with optional ?q= param and hydrate client component

Key Behaviors

  • Search triggers at 3+ characters minimum
  • Loading spinner positioning adapts based on clear button visibility
  • Browser back/forward navigation preserves search state
  • Initialization flag prevents useEffect race condition between URL sync and search execution

Tests

  • 23 unit tests: EmptyState, searchTasks action, TasksPageClient lifecycle
  • 13 E2E tests: UI interactions, URL persistence, browser navigation
// Search action with Prisma
const tasks = await prisma.task.findMany({
  where: {
    OR: [
      { name: { contains: query.trim(), mode: "insensitive" } },
      { description: { contains: query.trim(), mode: "insensitive" } }
    ]
  }
})

Non-Functional Notes

  • SSR-compatible: window checks prevent hydration issues
  • Filter button rendered but non-functional per requirements (future story)
Original prompt

This section details on the original issue you should resolve

<issue_title>TF-50 Add Text Search for Tasks</issue_title>
<issue_description> Implement the work described in Jira ticket TF-50, including looking at any Figma files mentioned. When finished, transition the ticket to "In Reivew".

To do the work use the following prompt chain which describes steps for best implementing the feature:

  1. Open the repository on GitHub: https://github.com/bitovi/ai-enablement-prompts.
  2. Execute the prompt writing-code/generate-feature/generate-feature.md</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits December 11, 2025 23:33
- Added searchTasks server action with case-insensitive search on name and description
- Created EmptyState UI component for no results
- Created TasksPageClient component with search input, clear button, and filter button
- Updated tasks page to use client component and handle URL query params
- Added 23 passing unit tests (empty-state, search-tasks, tasks-page-client)
- Search activates with 3+ characters minimum
- Loading spinner shown during search operations
- URL state persistence with pushState for browser navigation

Co-authored-by: BitoviAI <[email protected]>
- Added 13 E2E test cases covering search functionality
- Tests cover: search input UI, clear button, filtering, empty state, URL persistence, case-insensitivity, browser navigation
- All new code passes linting (no new warnings)
- Build successful

Co-authored-by: BitoviAI <[email protected]>
- Fixed potential race condition in useEffect hooks with initialization flag
- Added window check for SSR compatibility
- Fixed spinner positioning to avoid overlap when clear button is hidden
- All tests still passing
- Build successful

Co-authored-by: BitoviAI <[email protected]>
Copilot AI changed the title [WIP] Add text search feature for tasks TF-50: Add real-time text search for tasks Dec 11, 2025
Copilot AI requested a review from BitoviAI December 11, 2025 23:45
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.

TF-50 Add Text Search for Tasks

2 participants