Fix: Address HMR failures and Fast Refresh incompatibility

This commit is contained in:
gpt-engineer-app[bot]
2025-10-21 13:13:10 +00:00
parent 0d247d9fdd
commit 827f0f8ea5
8 changed files with 280 additions and 76 deletions

View File

@@ -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
} }
);
}
});