Fix version history errors

This commit is contained in:
gpt-engineer-app[bot]
2025-10-10 23:05:53 +00:00
parent 14d7801b6f
commit 0d625f3dc7
2 changed files with 4 additions and 19 deletions

View File

@@ -50,23 +50,8 @@ export function ContentTabs() {
.order('created_at', { ascending: false })
.limit(12);
// Fetch recent entity changes
const { data: changesData } = await supabase
.from('entity_versions')
.select(`
id,
entity_type,
entity_id,
version_number,
version_data,
changed_at,
change_type,
change_reason,
changer_profile:profiles!entity_versions_changed_by_fkey(username, avatar_url)
`)
.eq('is_current', true)
.order('changed_at', { ascending: false })
.limit(24);
// Recent changes will be populated from other sources since entity_versions requires auth
const changesData: any[] = [];
// Process changes to extract entity info from version_data
const processedChanges = changesData?.map(change => {

View File

@@ -247,7 +247,7 @@ export function useEntityVersions(entityType: string, entityId: string) {
if (entityType && entityId) {
fetchVersions();
}
}, [entityType, entityId, fetchVersions]);
}, [entityType, entityId]);
// Set up realtime subscription for version changes
useEffect(() => {
@@ -294,7 +294,7 @@ export function useEntityVersions(entityType: string, entityId: string) {
channelRef.current = null;
}
};
}, [entityType, entityId, fetchVersions]);
}, [entityType, entityId]);
// Set mounted ref on mount and cleanup on unmount
useEffect(() => {