mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 03:11:12 -05:00
Improve reliability when updating data subscriptions
Add try-catch block to handle potential errors during Supabase channel removal in `useEntityVersions.ts`. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 8e00d8b1-e8de-4f48-99ca-dbba7279e1a6 Replit-Commit-Checkpoint-Type: intermediate_checkpoint
This commit is contained in:
@@ -197,8 +197,13 @@ export function useEntityVersions(entityType: string, entityId: string) {
|
|||||||
|
|
||||||
// Clean up existing channel if any
|
// Clean up existing channel if any
|
||||||
if (channelRef.current) {
|
if (channelRef.current) {
|
||||||
supabase.removeChannel(channelRef.current);
|
try {
|
||||||
channelRef.current = null;
|
supabase.removeChannel(channelRef.current);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error removing previous channel:', error);
|
||||||
|
} finally {
|
||||||
|
channelRef.current = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new channel
|
// Create new channel
|
||||||
|
|||||||
Reference in New Issue
Block a user