UNPKG

next

Version:

The React Framework

22 lines (21 loc) 998 B
/** * Manages unhandled rejection listeners to intelligently filter rejections * from aborted prerenders when cache components are enabled. * * THE PROBLEM: * When we abort prerenders we expect to find numerous unhandled promise rejections due to * things like awaiting Request data like `headers()`. The rejections are fine and should * not be construed as problematic so we need to avoid the appearance of a problem by * omitting them from the logged output. * * THE STRATEGY: * 1. Install a filtering unhandled rejection handler * 2. Intercept process event methods to capture new handlers in our internal queue * 3. For each rejection, check if it comes from an aborted prerender context * 4. If yes, suppress it. If no, delegate to all handlers in our queue * 5. This provides precise filtering without time-based windows * * This ensures we suppress noisy prerender-related rejections while preserving * normal error logging for genuine unhandled rejections. */ export {};