Performance: Hooks (handle, handleError, handleFetch)
MEDIUM IMPACT
These hooks affect server-side request handling and error processing, impacting server response time and client load speed.
export const handle = async ({ event, resolve }) => { // minimal processing before resolve return await resolve(event); };
export const handle = async ({ event, resolve }) => { // heavy synchronous processing for (let i = 0; i < 100000000; i++) {} return await resolve(event); };
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Heavy synchronous code in handle hook | 0 | 0 | Blocks server response delaying paint | [X] Bad |
| Minimal async processing in handle hook | 0 | 0 | Fast server response enables quicker paint | [OK] Good |
| Unconditional header modification in handleFetch | 0 | 0 | Adds latency to fetch requests | [X] Bad |
| Conditional header modification in handleFetch | 0 | 0 | Reduces unnecessary fetch overhead | [OK] Good |
| Synchronous logging in handleError | 0 | 0 | Blocks error response delaying feedback | [X] Bad |
| Asynchronous logging in handleError | 0 | 0 | Non-blocking error handling improves responsiveness | [OK] Good |