File tree 2 files changed +23
-17
lines changed
integration-tests/ssr/__tests__
packages/gatsby/src/utils/dev-ssr 2 files changed +23
-17
lines changed Original file line number Diff line number Diff line change @@ -36,20 +36,20 @@ describe(`SSR`, () => {
36
36
`http://localhost:8000/bad-page/`
37
37
) . then ( res => res . text ( ) )
38
38
expect ( rawDevHtml ) . toMatchSnapshot ( )
39
- // fs.remove(dest)
39
+ fs . remove ( dest )
40
40
41
- // // After the page is gone, it'll 404.
42
- // await new Promise(resolve => {
43
- // setTimeout(() => {
44
- // const testInterval = setInterval(() => {
45
- // fetch(pageUrl).then(res => {
46
- // if (res.status === 404) {
47
- // clearInterval(testInterval)
48
- // resolve()
49
- // }
50
- // })
51
- // }, 400)
52
- // }, 400)
53
- // })
41
+ // After the page is gone, it'll 404.
42
+ await new Promise ( resolve => {
43
+ setTimeout ( ( ) => {
44
+ const testInterval = setInterval ( ( ) => {
45
+ fetch ( pageUrl ) . then ( res => {
46
+ if ( res . status === 404 ) {
47
+ clearInterval ( testInterval )
48
+ resolve ( )
49
+ }
50
+ } )
51
+ } , 400 )
52
+ } , 400 )
53
+ } )
54
54
} )
55
55
} )
Original file line number Diff line number Diff line change @@ -135,7 +135,13 @@ export const renderDevHTML = ({
135
135
createServerVisitedPage ( pageObj . componentChunkName )
136
136
137
137
// Ensure the query has been run and written out.
138
- await getPageDataExperimental ( pageObj . path )
138
+ try {
139
+ await getPageDataExperimental ( pageObj . path )
140
+ } catch {
141
+ // If we can't get the page, it was probably deleted recently
142
+ // so let's just do a 404 page.
143
+ return reject ( `404 page` )
144
+ }
139
145
140
146
// Wait for public/render-page.js to update w/ the page component.
141
147
const found = await ensurePathComponentInSSRBundle ( pageObj , directory )
@@ -158,8 +164,8 @@ export const renderDevHTML = ({
158
164
directory,
159
165
isClientOnlyPage,
160
166
} )
161
- resolve ( htmlString )
167
+ return resolve ( htmlString )
162
168
} catch ( error ) {
163
- reject ( error )
169
+ return reject ( error )
164
170
}
165
171
} )
You can’t perform that action at this time.
0 commit comments