mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 08:11:13 -05:00
Fix: Address HMR failures and Fast Refresh incompatibility
This commit is contained in:
@@ -3,6 +3,7 @@ import { useToast } from '@/hooks/use-toast';
|
||||
import { useUserRole } from '@/hooks/useUserRole';
|
||||
import { useAuth } from '@/hooks/useAuth';
|
||||
import { handleError } from '@/lib/errorHandler';
|
||||
import { invokeWithTracking } from '@/lib/edgeFunctionTracking';
|
||||
import {
|
||||
fetchSubmissionItems,
|
||||
buildDependencyTree,
|
||||
@@ -213,12 +214,14 @@ export function SubmissionReviewManager({
|
||||
const { supabase } = await import('@/integrations/supabase/client');
|
||||
|
||||
// Call the edge function for backend processing
|
||||
const { data, error } = await supabase.functions.invoke('process-selective-approval', {
|
||||
body: {
|
||||
const { data, error, requestId } = await invokeWithTracking(
|
||||
'process-selective-approval',
|
||||
{
|
||||
itemIds: Array.from(selectedItemIds),
|
||||
submissionId
|
||||
}
|
||||
});
|
||||
},
|
||||
user?.id
|
||||
);
|
||||
|
||||
if (error) {
|
||||
throw new Error(error.message || 'Failed to process approval');
|
||||
@@ -228,6 +231,11 @@ export function SubmissionReviewManager({
|
||||
throw new Error(data?.error || 'Approval processing failed');
|
||||
}
|
||||
|
||||
toast({
|
||||
title: 'Items Approved',
|
||||
description: `Successfully approved ${selectedItemIds.size} item(s)${requestId ? ` (Request: ${requestId.substring(0, 8)})` : ''}`,
|
||||
});
|
||||
|
||||
const successCount = data.results.filter((r: any) => r.success).length;
|
||||
const failCount = data.results.filter((r: any) => !r.success).length;
|
||||
|
||||
@@ -343,13 +351,15 @@ export function SubmissionReviewManager({
|
||||
const { supabase } = await import('@/integrations/supabase/client');
|
||||
|
||||
// Call the escalation notification edge function
|
||||
const { data, error } = await supabase.functions.invoke('send-escalation-notification', {
|
||||
body: {
|
||||
const { data, error, requestId } = await invokeWithTracking(
|
||||
'send-escalation-notification',
|
||||
{
|
||||
submissionId,
|
||||
escalationReason: reason,
|
||||
escalatedBy: user.id
|
||||
}
|
||||
});
|
||||
},
|
||||
user.id
|
||||
);
|
||||
|
||||
if (error) {
|
||||
console.error('Edge function error:', error);
|
||||
@@ -409,12 +419,14 @@ export function SubmissionReviewManager({
|
||||
try {
|
||||
if (status === 'approved') {
|
||||
const { supabase } = await import('@/integrations/supabase/client');
|
||||
const { data, error } = await supabase.functions.invoke('process-selective-approval', {
|
||||
body: {
|
||||
const { data, error, requestId } = await invokeWithTracking(
|
||||
'process-selective-approval',
|
||||
{
|
||||
itemIds: [itemId],
|
||||
submissionId
|
||||
}
|
||||
});
|
||||
},
|
||||
user?.id
|
||||
);
|
||||
|
||||
if (error || !data?.success) {
|
||||
throw new Error(error?.message || data?.error || 'Failed to approve item');
|
||||
@@ -422,7 +434,7 @@ export function SubmissionReviewManager({
|
||||
|
||||
toast({
|
||||
title: 'Item Approved',
|
||||
description: 'Successfully approved the item',
|
||||
description: `Successfully approved the item${requestId ? ` (Request: ${requestId.substring(0, 8)})` : ''}`,
|
||||
});
|
||||
} else {
|
||||
const item = items.find(i => i.id === itemId);
|
||||
|
||||
Reference in New Issue
Block a user