refactor: reorganize hooks and add safety checks

fix(api): add validation for listing and seller in bid route
feat(telemetry): add userId to MarketTelemetry
style(globe): add null check for canvas element
chore: add lint:fix script to package.json
This commit is contained in:
Evandro Fonseca Junior committed 2025-11-11 03:20:01 -03:00
1 parent 47c04de6fe
commit 6adc8d96e8
12 files changed
+119 -89

No files matched your search

+13 -14
View File
@@ -69,20 +69,6 @@ export function MessagesPanel({
setIsLoading(false);
}
};
useEffect(() => {
if (open && user) {
fetchChats();
// Marcar todos como lidos ao abrir
markAllAsRead();
}
}, [
open,
user,
fetchChats, // Marcar todos como lidos ao abrir
markAllAsRead,
]);
const markAllAsRead = async () => {
try {
await fetch("/api/chats/mark-all-read", {
@@ -105,6 +91,19 @@ export function MessagesPanel({
}
};
useEffect(() => {
if (open && user) {
fetchChats();
// Marcar todos como lidos ao abrir
markAllAsRead();
}
}, [
open,
user,
fetchChats, // Marcar todos como lidos ao abrir
markAllAsRead,
]);
const handleChatClick = (chatId: string, _listingId: number) => {
setSelectedChatId(chatId);
setShowChatModal(true);