Skip to content

Commit

Permalink
Remove React Suspense from Client Runtime (#8887)
Browse files Browse the repository at this point in the history
  • Loading branch information
Timer authored and timneutkens committed Sep 28, 2019
1 parent e930961 commit d9c6f20
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
18 changes: 8 additions & 10 deletions packages/next/client/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* global location */
import React, { Suspense } from 'react'
import React from 'react'
import ReactDOM from 'react-dom'
import HeadManager from './head-manager'
import { createRouter, makePublicRouterInstance } from 'next/router'
Expand Down Expand Up @@ -319,15 +319,13 @@ function AppContainer ({ children }) {
)
}
>
<Suspense fallback={<div>Loading...</div>}>
<RouterContext.Provider value={makePublicRouterInstance(router)}>
<DataManagerContext.Provider value={dataManager}>
<HeadManagerContext.Provider value={headManager.updateHead}>
{children}
</HeadManagerContext.Provider>
</DataManagerContext.Provider>
</RouterContext.Provider>
</Suspense>
<RouterContext.Provider value={makePublicRouterInstance(router)}>
<DataManagerContext.Provider value={dataManager}>
<HeadManagerContext.Provider value={headManager.updateHead}>
{children}
</HeadManagerContext.Provider>
</DataManagerContext.Provider>
</RouterContext.Provider>
</Container>
)
}
Expand Down
19 changes: 19 additions & 0 deletions test/integration/data/pages/_app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React, { Suspense } from 'react'
import App from 'next/app'

class MyApp extends App {
render () {
const { Component, pageProps } = this.props
if (typeof window === 'undefined') {
return <Component {...pageProps} />
}

return (
<Suspense fallback={<div>Loading...</div>}>
<Component {...pageProps} />
</Suspense>
)
}
}

export default MyApp

0 comments on commit d9c6f20

Please sign in to comment.