mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 12:31:26 -05:00
Fix: Address HMR failures and Fast Refresh incompatibility
This commit is contained in:
@@ -12,7 +12,13 @@ interface EscalationRequest {
|
||||
escalatedBy: string;
|
||||
}
|
||||
|
||||
// Simple request tracking
|
||||
const startRequest = () => ({ requestId: crypto.randomUUID(), start: Date.now() });
|
||||
const endRequest = (tracking: { start: number }) => Date.now() - tracking.start;
|
||||
|
||||
serve(async (req) => {
|
||||
const tracking = startRequest();
|
||||
|
||||
if (req.method === 'OPTIONS') {
|
||||
return new Response(null, { headers: corsHeaders });
|
||||
}
|
||||
@@ -218,22 +224,36 @@ serve(async (req) => {
|
||||
console.error('Failed to update submission escalation status:', updateError);
|
||||
}
|
||||
|
||||
const duration = endRequest(tracking);
|
||||
console.log('Escalation notification sent', { requestId: tracking.requestId, duration, emailId: emailResult.id });
|
||||
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
success: true,
|
||||
message: 'Escalation notification sent successfully',
|
||||
emailId: emailResult.id
|
||||
emailId: emailResult.id,
|
||||
requestId: tracking.requestId
|
||||
}),
|
||||
{ headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
|
||||
{ headers: {
|
||||
...corsHeaders,
|
||||
'Content-Type': 'application/json',
|
||||
'X-Request-ID': tracking.requestId
|
||||
} }
|
||||
);
|
||||
} catch (error) {
|
||||
console.error('Error in send-escalation-notification:', error);
|
||||
const duration = endRequest(tracking);
|
||||
console.error('Error in send-escalation-notification:', error, { requestId: tracking.requestId, duration });
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
error: error instanceof Error ? error.message : 'Unknown error occurred',
|
||||
details: 'Failed to send escalation notification'
|
||||
details: 'Failed to send escalation notification',
|
||||
requestId: tracking.requestId
|
||||
}),
|
||||
{ status: 500, headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
|
||||
{ status: 500, headers: {
|
||||
...corsHeaders,
|
||||
'Content-Type': 'application/json',
|
||||
'X-Request-ID': tracking.requestId
|
||||
} }
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user