diff --git a/app/components/DeleteButton.tsx b/app/components/DeleteButton.tsx index 5367ca7..6776c84 100644 --- a/app/components/DeleteButton.tsx +++ b/app/components/DeleteButton.tsx @@ -51,7 +51,7 @@ export function DeleteButton({ produtoId, produtoNome, listaId }: DeleteButtonPr Confirmar exclusão - Tem certeza que deseja excluir o produto "{produtoNome}"? + Tem certeza que deseja excluir o produto "{produtoNome}"? Esta ação não pode ser desfeita. diff --git a/app/components/IdInput.tsx b/app/components/IdInput.tsx index b523abc..923ede9 100644 --- a/app/components/IdInput.tsx +++ b/app/components/IdInput.tsx @@ -30,7 +30,7 @@ export function IdInput() { } else { setError('Erro ao acessar/criar lista') } - } catch (error) { + } catch { setError('Erro ao processar solicitação') } finally { setLoading(false) diff --git a/app/components/ListHeader.tsx b/app/components/ListHeader.tsx index 28b53f6..e2f79ad 100644 --- a/app/components/ListHeader.tsx +++ b/app/components/ListHeader.tsx @@ -59,7 +59,7 @@ export function ListHeader({ listaId }: ListHeaderProps) { } } } - } catch (error) { + } catch { setError('Erro ao processar solicitação') } finally { setLoading(false) diff --git a/app/components/PageTitle.tsx b/app/components/PageTitle.tsx index 9c7743f..770711e 100644 --- a/app/components/PageTitle.tsx +++ b/app/components/PageTitle.tsx @@ -1,10 +1,8 @@ 'use client' import { motion } from 'framer-motion' -import { useTheme } from 'next-themes' - export function PageTitle() { - const { theme } = useTheme() + return ( () // Debounce utility -export function debounce any>( +export function debounce unknown>( func: T, wait: number ): (...args: Parameters) => void { @@ -22,21 +22,24 @@ export function debounce any>( } // Memoização para cálculos pesados -export function memoize any>( - func: T, - resolver?: (...args: Parameters) => string -): T { - const cache = new Map>() +export function memoize( + func: (...args: TArgs) => TResult, + resolver?: (...args: TArgs) => string +): typeof func { + const cache = new Map() - return ((...args: Parameters) => { + return ((...args: TArgs) => { const key = resolver ? resolver(...args) : JSON.stringify(args) - if (cache.has(key)) { - return cache.get(key) + const cachedResult = cache.get(key) + + if (cachedResult !== undefined) { + return cachedResult } + const result = func(...args) cache.set(key, result) return result - }) as T + }) as typeof func } // Medição de performance