-
Notifications
You must be signed in to change notification settings - Fork 26.2k
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
Expose app.js #4129
Merged
Merged
Expose app.js #4129
Changes from 12 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
e24d861
Expose pages/_app.js
timneutkens d01623f
Add tests for _app and _document
timneutkens 6eb23be
Uncomment deprecation warnings
timneutkens 7c9a422
Add documentation for _app, improve documentation of _document
timneutkens 407f067
Update docs / test for _document
timneutkens 1ac18ca
Add _document to client compiler in development
timneutkens 8c1d25c
Add missing app.js to comment
timneutkens a87e37f
Only warn once
timneutkens ffcc795
Add url-deprecated error page
timneutkens 97ca475
Combine tests
timneutkens 3bec435
Yse same message for all methods of ‘props.url’
timneutkens 1e7cde8
Update docs around _app
timneutkens 3ac230a
Update documentation
timneutkens b7bbee2
Quotes
timneutkens f126dfb
Update table of contents
timneutkens 30089b7
Merge branch 'canary' of github.com:zeit/next.js into add/layout
timneutkens File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./dist/lib/app') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Url is deprecated | ||
|
||
#### Why This Error Occurred | ||
|
||
In version prior to 6.x `url` got magically injected into every page component, since this is confusing and can now be added by the user using a custom `_app.js` we have deprecated this feature. To be removed in Next.js 7.0 | ||
|
||
#### Possible Ways to Fix It | ||
|
||
The easiest way to get the same values that `url` had is to use `withRouter`: | ||
|
||
```js | ||
import { withRouter } from 'next/router' | ||
|
||
class Page extends React.Component { | ||
render() { | ||
const {router} = this.props | ||
console.log(router) | ||
return <div>{router.pathname}</div> | ||
} | ||
} | ||
|
||
export default withRouter(Page) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('next/app') |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If user didn't override
getInitialProps
in his/her sub class, is this going to execute?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep 👍 (Basically the same as
_document.js
that also implementsgetInitialProps