Refactor: Implement logging and JSONB cleanup

This commit is contained in:
gpt-engineer-app[bot]
2025-11-03 18:05:58 +00:00
parent b6179372e6
commit e9b9faa3e1
18 changed files with 430 additions and 142 deletions

View File

@@ -1,6 +1,7 @@
import { useState, useEffect } from 'react';
import { supabase } from '@/integrations/supabase/client';
import type { EntityType, VersionDiff } from '@/types/versioning';
import { handleError } from '@/lib/errorHandler';
/**
* Hook to compare two versions of an entity and get the diff
@@ -37,7 +38,10 @@ export function useVersionComparison(
setDiff(data as VersionDiff);
} catch (err) {
console.error('Error fetching version diff:', err);
handleError(err, {
action: 'Compare Versions',
metadata: { entityType, fromVersionId, toVersionId }
});
setError(err instanceof Error ? err.message : 'Failed to compare versions');
setDiff(null);
} finally {