mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 00:51:12 -05:00
Remove real-time updates
This commit is contained in:
@@ -40,57 +40,6 @@ export default function OperatorDetail() {
|
||||
}
|
||||
}, [slug]);
|
||||
|
||||
// Real-time subscription for parks, rides, and photos changes
|
||||
useEffect(() => {
|
||||
if (!operator?.id) return;
|
||||
|
||||
const channel = supabase
|
||||
.channel('operator-stats-changes')
|
||||
.on(
|
||||
'postgres_changes',
|
||||
{
|
||||
event: '*',
|
||||
schema: 'public',
|
||||
table: 'parks',
|
||||
filter: `operator_id=eq.${operator.id}`
|
||||
},
|
||||
(payload) => {
|
||||
console.log('Park change detected for operator:', payload);
|
||||
fetchStatistics(operator.id);
|
||||
}
|
||||
)
|
||||
.on(
|
||||
'postgres_changes',
|
||||
{
|
||||
event: 'UPDATE',
|
||||
schema: 'public',
|
||||
table: 'rides'
|
||||
},
|
||||
(payload) => {
|
||||
console.log('Ride status change detected:', payload);
|
||||
fetchStatistics(operator.id);
|
||||
}
|
||||
)
|
||||
.on(
|
||||
'postgres_changes',
|
||||
{
|
||||
event: '*',
|
||||
schema: 'public',
|
||||
table: 'photos',
|
||||
filter: `entity_type=eq.operator,entity_id=eq.${operator.id}`
|
||||
},
|
||||
(payload) => {
|
||||
console.log('Photo change detected for operator:', payload);
|
||||
fetchPhotoCount(operator.id);
|
||||
}
|
||||
)
|
||||
.subscribe();
|
||||
|
||||
return () => {
|
||||
supabase.removeChannel(channel);
|
||||
};
|
||||
}, [operator?.id]);
|
||||
|
||||
const fetchOperatorData = async () => {
|
||||
try {
|
||||
const { data, error } = await supabase
|
||||
|
||||
Reference in New Issue
Block a user