@@ -13,6 +13,7 @@ import type AppPageRouteModule from '../route-modules/app-page/module'
1313import type { LoaderTree } from '../lib/app-dir-module'
1414import { workAsyncStorage } from '../app-render/work-async-storage.external'
1515import { workUnitAsyncStorage } from '../app-render/work-unit-async-storage.external'
16+ import { isHangingPromiseRejectionError } from '../dynamic-rendering-utils'
1617
1718// Helper to create LoaderTree structures for testing
1819type TestLoaderTree = [
@@ -693,6 +694,7 @@ describe('output export fallback params consumers', () => {
693694 reactServerErrorsByDigest : new Map ( ) ,
694695 } as any
695696
697+ const controller = new AbortController ( )
696698 const prerenderStore = {
697699 type : 'prerender' ,
698700 phase : 'render' ,
@@ -701,8 +703,8 @@ describe('output export fallback params consumers', () => {
701703 expire : 0 ,
702704 stale : 0 ,
703705 tags : null ,
704- renderSignal : new AbortController ( ) . signal ,
705- controller : new AbortController ( ) ,
706+ renderSignal : controller . signal ,
707+ controller,
706708 cacheSignal : null ,
707709 dynamicTracking : null ,
708710 rootParams : underlyingParams ,
@@ -727,6 +729,25 @@ describe('output export fallback params consumers', () => {
727729 expect ( serverParams ) . not . toBe ( clientParams )
728730 expect ( ( ) => serverParams . then ( ( ) => null ) ) . toThrow ( 'output: export' )
729731 expect ( ( ) => clientParams . then ( ( ) => null ) ) . not . toThrow ( )
732+
733+ const clientOutcome = await Promise . race ( [
734+ clientParams . then (
735+ ( ) => 'resolved' ,
736+ ( ) => 'rejected'
737+ ) ,
738+ new Promise < 'pending' > ( ( resolve ) =>
739+ setTimeout ( ( ) => resolve ( 'pending' ) )
740+ ) ,
741+ ] )
742+ expect ( clientOutcome ) . toBe ( 'pending' )
743+
744+ controller . abort ( )
745+ try {
746+ await clientParams
747+ throw new Error ( 'Expected client params to reject after abort' )
748+ } catch ( error ) {
749+ expect ( isHangingPromiseRejectionError ( error ) ) . toBe ( true )
750+ }
730751 } )
731752 } )
732753 } )
0 commit comments