@@ -1575,4 +1575,43 @@ describe('GridField — the lazy face the package exports (objectstack#36102)',
15751575 const cell = screen . getByTestId ( 'line-items' ) . querySelector ( 'input[aria-label="Description"]' ) as HTMLInputElement ;
15761576 expect ( cell . value ) . toBe ( 'Widget' ) ;
15771577 } ) ;
1578+
1579+ // objectstack#36451 — a host that renders the face without preloading, whose
1580+ // first request for the body fails once (a network blip, a deploy that
1581+ // swapped chunk names), must not keep that failure for the whole session.
1582+ it ( 'a mount after a failed load of the body renders the grid once the body is reachable, with no reload' , async ( ) => {
1583+ class Boundary extends React . Component < { children : React . ReactNode } , { failed : boolean } > {
1584+ state = { failed : false } ;
1585+ static getDerivedStateFromError ( ) {
1586+ return { failed : true } ;
1587+ }
1588+ render ( ) {
1589+ return this . state . failed ? < div data-testid = "grid-load-failed" /> : this . props . children ;
1590+ }
1591+ }
1592+ vi . resetModules ( ) ;
1593+ let failNextLoad = true ;
1594+ vi . doMock ( './grid-field/GridFieldWidget' , async ( importOriginal ) => {
1595+ if ( failNextLoad ) {
1596+ failNextLoad = false ;
1597+ throw new Error ( 'Failed to fetch dynamically imported module: fields-grid' ) ;
1598+ }
1599+ return importOriginal ( ) ;
1600+ } ) ;
1601+ const quiet = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
1602+ try {
1603+ const face = await import ( './GridField' ) ;
1604+ const first = render ( < Boundary > < face . GridField value = { lines } onChange = { ( ) => { } } field = { field } /> </ Boundary > ) ;
1605+ await screen . findByTestId ( 'grid-load-failed' ) ;
1606+ first . unmount ( ) ;
1607+
1608+ render ( < Boundary > < face . GridField value = { lines } onChange = { ( ) => { } } field = { field } /> </ Boundary > ) ;
1609+ const cell = ( await screen . findByTestId ( 'line-items' ) ) . querySelector ( 'input[aria-label="Description"]' ) as HTMLInputElement ;
1610+ expect ( cell . value ) . toBe ( 'Widget' ) ;
1611+ expect ( screen . queryByTestId ( 'grid-load-failed' ) ) . toBeNull ( ) ;
1612+ } finally {
1613+ quiet . mockRestore ( ) ;
1614+ vi . doUnmock ( './grid-field/GridFieldWidget' ) ;
1615+ }
1616+ } ) ;
15781617} ) ;
0 commit comments