Fix build errors and complete transformation

This commit is contained in:
gpt-engineer-app[bot]
2025-10-15 18:20:47 +00:00
parent f58d7d6014
commit fc752bcd54
3 changed files with 132 additions and 225 deletions

View File

@@ -88,32 +88,14 @@ export function useEntityVersions(entityType: EntityType, entityId: string) {
}
}, [entityType, entityId]);
/**
* Field history has been removed - use version comparison instead
* This function is kept for backward compatibility but does nothing
* @deprecated Use compareVersions() to see field-level changes
*/
const fetchFieldHistory = async (versionId: string) => {
if (!isMountedRef.current) return;
const currentRequestId = ++fieldHistoryRequestCounterRef.current;
try {
const { data, error } = await supabase
.from('entity_field_history')
.select('*')
.eq('version_id', versionId)
.order('created_at', { ascending: false });
if (error) throw error;
if (isMountedRef.current && currentRequestId === fieldHistoryRequestCounterRef.current) {
const fieldChanges = Array.isArray(data) ? data as FieldChange[] : [];
setFieldHistory(fieldChanges);
}
} catch (error: any) {
console.error('Error fetching field history:', error);
if (isMountedRef.current && currentRequestId === fieldHistoryRequestCounterRef.current) {
const errorMessage = error?.message || 'Failed to load field history';
toast.error(errorMessage);
}
}
console.warn('fetchFieldHistory is deprecated. Use compareVersions() instead for field-level changes.');
setFieldHistory([]);
};
const compareVersions = async (fromVersionId: string, toVersionId: string) => {