feat: 🐛

This commit is contained in:
Evandro committed 2024-11-28 13:00:26 -03:00
1 parent 1dd2dffed8
commit b3eceeb78d
7 files changed
+19 -18

No files matched your search

+1 -1
View File
@@ -51,7 +51,7 @@ export function DeleteButton({ produtoId, produtoNome, listaId }: DeleteButtonPr
<AlertDialogHeader>
<AlertDialogTitle>Confirmar exclusão</AlertDialogTitle>
<AlertDialogDescription>
Tem certeza que deseja excluir o produto "{produtoNome}"?
Tem certeza que deseja excluir o produto &quot;{produtoNome}&quot;?
Esta ação não pode ser desfeita.
</AlertDialogDescription>
</AlertDialogHeader>
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -59,7 +59,7 @@ export function ListHeader({ listaId }: ListHeaderProps) {
}
}
}
} catch (error) {
} catch {
setError('Erro ao processar solicitação')
} finally {
setLoading(false)
+1 -3
View File
@@ -1,10 +1,8 @@
'use client'
import { motion } from 'framer-motion'
import { useTheme } from 'next-themes'
export function PageTitle() {
const { theme } = useTheme()
return (
<motion.div
+1 -1
View File
@@ -14,7 +14,7 @@ interface ListaPageProps {
}
export default async function ListaPage({ params }: ListaPageProps) {
const { success, exists } = await verificarLista(params.id);
const { success } = await verificarLista(params.id);
if (!success) {
redirect('/');
+1 -1
View File
@@ -2,7 +2,7 @@
import * as React from "react"
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
import { Check, ChevronRight, Circle } from "lucide-react"
import { ChevronRight } from "lucide-react"
import { cn } from "@/lib/utils"
+13 -10
View File
@@ -9,7 +9,7 @@ export function cn(...inputs: ClassValue[]) {
const perfCache = new Map<string, number>()
// Debounce utility
export function debounce<T extends (...args: any[]) => any>(
export function debounce<T extends (...args: unknown[]) => unknown>(
func: T,
wait: number
): (...args: Parameters<T>) => void {
@@ -22,21 +22,24 @@ export function debounce<T extends (...args: any[]) => any>(
}
// Memoização para cálculos pesados
export function memoize<T extends (...args: any[]) => any>(
func: T,
resolver?: (...args: Parameters<T>) => string
): T {
const cache = new Map<string, ReturnType<T>>()
export function memoize<TArgs extends unknown[], TResult>(
func: (...args: TArgs) => TResult,
resolver?: (...args: TArgs) => string
): typeof func {
const cache = new Map<string, TResult>()
return ((...args: Parameters<T>) => {
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