fix: recherche insensible à la casse et aux accents dans tous les filtres
- utils/search.ts : normalize() (NFD + minuscules) + matchesSearch() - ShoppingPage filteredProducts : matchesSearch sur nom ET marque - Backend searchProducts : ilike sur nom ET marque (or_) - Notes FTS : déjà insensible nativement (plainto_tsquery) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
// frontend/src/pages/ShoppingPage.tsx
|
||||
import { useState, useEffect, useCallback } from 'react'
|
||||
import { matchesSearch } from '../utils/search'
|
||||
import type { ShoppingListDetail, ShoppingList, Store, Product } from '../api/shopping'
|
||||
import {
|
||||
fetchLists, createList, fetchListDetail, deleteList,
|
||||
@@ -213,9 +214,10 @@ export default function ShoppingPage() {
|
||||
const hasCurrentList = currentList !== null
|
||||
const pastLists = allLists.filter(l => l.status === 'done')
|
||||
|
||||
const filteredProducts = products.filter(
|
||||
p => !itemSearch.trim() || p.name.toLowerCase().includes(itemSearch.trim().toLowerCase())
|
||||
)
|
||||
const filteredProducts = products.filter(p => {
|
||||
const term = itemSearch.trim()
|
||||
return !term || matchesSearch(p.name, term) || matchesSearch(p.brand ?? '', term)
|
||||
})
|
||||
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', minHeight: '100%' }}>
|
||||
|
||||
Reference in New Issue
Block a user