Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove React Suspense from Client Runtime #8887

Merged
merged 1 commit into from
Sep 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this test covering, isn't Suspense failing?

P. S. I'm completely new to next.js, let alone its development.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The data folder covers an experimental feature we've been developing, it's unrelated to anything else.

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