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

[WIP] Initial support for React fiber. #2659

Closed
wants to merge 1 commit into from
Closed
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
15 changes: 0 additions & 15 deletions client/next-dev.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'react-hot-loader/patch'
import ReactReconciler from 'react-dom/lib/ReactReconciler'
import initOnDemandEntries from './on-demand-entries-client'
import initWebpackHMR from './webpack-hot-middleware-client'

Expand Down Expand Up @@ -35,17 +34,3 @@ next.default()
.catch((err) => {
console.error(`${err.message}\n${err.stack}`)
})

// This is a patch to catch most of the errors throw inside React components.
const originalMountComponent = ReactReconciler.mountComponent
ReactReconciler.mountComponent = function (...args) {
try {
return originalMountComponent(...args)
} catch (err) {
if (!err.abort) {
next.renderError(err)
err.abort = true
}
throw err
}
}
14 changes: 14 additions & 0 deletions lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import shallowEquals from './shallow-equals'
import { warn } from './utils'

export default class App extends Component {
state = {
error: null
}

static childContextTypes = {
headManager: PropTypes.object
}
Expand All @@ -13,7 +17,17 @@ export default class App extends Component {
return { headManager }
}

componentDidCatch (error, errorInfo) {
error.stack = `${error.stack}\n\n${errorInfo.componentStack}`
window.next.renderError(error)
this.setState({ error })
}

render () {
if (this.state.error) {
return null
}

const { Component, props, hash, router } = this.props
const url = createUrl(router)
// If there no component exported we can't proceed.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@
"node-notifier": "5.1.2",
"nyc": "11.0.3",
"portfinder": "^1.0.13",
"react": "15.5.4",
"react-dom": "15.5.4",
"react": "next",
"react-dom": "next",
"standard": "9.0.2",
"taskr": "1.0.6",
"wd": "1.4.0"
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4394,7 +4394,7 @@ prop-types-exact@^1.1.1:
has "^1.0.1"
object.assign "^4.0.4"

[email protected], prop-types@^15.5.4, prop-types@^15.5.7, prop-types@~15.5.7:
[email protected], prop-types@^15.5.4, prop-types@^15.5.6:
version "15.5.10"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.5.10.tgz#2797dfc3126182e3a95e3dfbb2e893ddd7456154"
dependencies:
Expand Down Expand Up @@ -4484,14 +4484,14 @@ react-deep-force-update@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/react-deep-force-update/-/react-deep-force-update-2.0.1.tgz#4f7f6c12c3e7de42f345992a3c518236fa1ecad3"

react-dom@15.5.4:
version "15.5.4"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.5.4.tgz#ba0c28786fd52ed7e4f2135fe0288d462aef93da"
react-dom@next:
version "16.0.0-beta.1"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.0.0-beta.1.tgz#be3e958578dae850884f7abd7ba559f9dfb39815"
dependencies:
fbjs "^0.8.9"
loose-envify "^1.1.0"
object-assign "^4.1.0"
prop-types "~15.5.7"
prop-types "^15.5.6"

[email protected]:
version "3.0.0-beta.7"
Expand All @@ -4510,14 +4510,14 @@ react-proxy@^3.0.0-alpha.0:
dependencies:
lodash "^4.6.1"

react@15.5.4:
version "15.5.4"
resolved "https://registry.yarnpkg.com/react/-/react-15.5.4.tgz#fa83eb01506ab237cdc1c8c3b1cea8de012bf047"
react@next:
version "16.0.0-beta.1"
resolved "https://registry.yarnpkg.com/react/-/react-16.0.0-beta.1.tgz#c02171171e9638b0c506f5a26b90e918f76909ab"
dependencies:
fbjs "^0.8.9"
loose-envify "^1.1.0"
object-assign "^4.1.0"
prop-types "^15.5.7"
prop-types "^15.5.6"

read-pkg-up@^1.0.1:
version "1.0.1"
Expand Down