mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 04:51:13 -05:00
feat: Implement High Priority Console Cleanup
This commit is contained in:
@@ -109,7 +109,7 @@ export function useEntityVersions(entityType: EntityType, entityId: string) {
|
||||
}
|
||||
} catch (error: unknown) {
|
||||
const errorMsg = getErrorMessage(error);
|
||||
console.error('Error fetching versions:', errorMsg);
|
||||
logger.error('Failed to fetch versions', { entityType, entityId, error: errorMsg });
|
||||
|
||||
if (isMountedRef.current && currentRequestId === requestCounterRef.current) {
|
||||
toast.error(errorMsg);
|
||||
@@ -141,7 +141,7 @@ export function useEntityVersions(entityType: EntityType, entityId: string) {
|
||||
return data;
|
||||
} catch (error: unknown) {
|
||||
const errorMsg = getErrorMessage(error);
|
||||
console.error('Error comparing versions:', errorMsg);
|
||||
logger.error('Failed to compare versions', { entityType, fromVersionId, toVersionId, error: errorMsg });
|
||||
if (isMountedRef.current) {
|
||||
toast.error(errorMsg);
|
||||
}
|
||||
@@ -173,7 +173,7 @@ export function useEntityVersions(entityType: EntityType, entityId: string) {
|
||||
return data;
|
||||
} catch (error: unknown) {
|
||||
const errorMsg = getErrorMessage(error);
|
||||
console.error('Error rolling back version:', errorMsg);
|
||||
logger.error('Failed to rollback version', { entityType, entityId, targetVersionId, error: errorMsg });
|
||||
if (isMountedRef.current) {
|
||||
toast.error(errorMsg);
|
||||
}
|
||||
@@ -194,6 +194,7 @@ export function useEntityVersions(entityType: EntityType, entityId: string) {
|
||||
try {
|
||||
supabase.removeChannel(channelRef.current);
|
||||
} catch (error: unknown) {
|
||||
logger.error('Failed to cleanup realtime subscription', { entityType, entityId, error: getErrorMessage(error) });
|
||||
console.error('Error removing previous channel:', error);
|
||||
} finally {
|
||||
channelRef.current = null;
|
||||
@@ -226,6 +227,7 @@ export function useEntityVersions(entityType: EntityType, entityId: string) {
|
||||
return () => {
|
||||
if (channelRef.current) {
|
||||
supabase.removeChannel(channelRef.current).catch((error) => {
|
||||
logger.error('Failed to cleanup realtime subscription', { entityType, entityId, error: getErrorMessage(error) });
|
||||
console.error('Error removing channel:', error);
|
||||
});
|
||||
channelRef.current = null;
|
||||
|
||||
Reference in New Issue
Block a user