Skip to content

Conversation

@marcuscastelo
Copy link
Owner

This pull request fixes a bug where the "Recentes" tab in the search modal ignored the search field and always displayed all recent items. Now, the recents list is filtered by the search field, matching both name and barcode, case-insensitively, for consistency with other tabs.

What was changed:

  • Refactored fetchRecentsForModal to accept a search string and filter results by name or barcode.
  • Updated fetchFunc to pass the current search string to fetchRecentsForModal.
  • No changes to UI or state management logic outside the filtering behavior.

Why:

  • Improves user experience by allowing users to efficiently find recent items by name or barcode, matching the behavior of other search tabs.

Implementation details:

  • Filtering is case-insensitive and applies to both name and barcode fields.
  • No breaking changes or changes to the public API.

closes #744

…nsensitive)

- Refactor fetchRecentsForModal to accept a search string and filter results
- Update fetchFunc to pass the search string for the 'recent' tab
- Ensures recents tab matches user expectations and other tabs' behavior
Copilot AI review requested due to automatic review settings June 12, 2025 21:34
@marcuscastelo marcuscastelo self-assigned this Jun 12, 2025
@vercel
Copy link

vercel bot commented Jun 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
marucs-diet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 12, 2025 9:59pm

@github-actions github-actions bot added bug Report a problem or malfunction complexity-low Low implementation complexity needs-investigation Requires investigation or analysis ui UI/UX related issue or improvement labels Jun 12, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the “Recent” tab in the search modal by filtering its items based on the search input and wires the search string through the fetch function.

  • Refactored fetchRecentsForModal to accept an optional search string and filter by name or barcode, case-insensitively.
  • Updated fetchFunc to pass templateSearch() into fetchRecentsForModal.
  • No UI or external state changes.
Comments suppressed due to low confidence (1)

src/modules/search/application/search.ts:57

  • No unit tests cover the new filtering behavior in fetchRecentsForModal. Consider adding tests for cases with empty search, matching name, matching barcode, and non-matches.
const lowerSearch = search.trim().toLowerCase()

@marcuscastelo marcuscastelo merged commit 8bd1929 into rc/v0.12.0 Jun 12, 2025
7 checks passed
@marcuscastelo marcuscastelo deleted the marcuscastelo/issue744 branch June 12, 2025 21:59
@marcuscastelo marcuscastelo mentioned this pull request Jun 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Report a problem or malfunction complexity-low Low implementation complexity needs-investigation Requires investigation or analysis ui UI/UX related issue or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recents search tab ignores search field and always returns all recent items

2 participants