forked from vercel/next.js
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhance-with-redux-saga (vercel#13764)
[11014](vercel#11014) Removed getInitialProps from _app
- Loading branch information
1 parent
a6bbd2d
commit bd13f43
Showing
8 changed files
with
19 additions
and
104 deletions.
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
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 |
---|---|---|
@@ -1,27 +1,7 @@ | ||
import App from 'next/app' | ||
import { END } from 'redux-saga' | ||
import { wrapper } from '../store' | ||
|
||
class MyApp extends App { | ||
static async getInitialProps({ Component, ctx }) { | ||
const pageProps = { | ||
...(Component.getInitialProps | ||
? await Component.getInitialProps(ctx) | ||
: {}), | ||
} | ||
|
||
if (ctx.req) { | ||
ctx.store.dispatch(END) | ||
await ctx.store.sagaTask.toPromise() | ||
} | ||
|
||
return { pageProps } | ||
} | ||
|
||
render() { | ||
const { Component, pageProps } = this.props | ||
return <Component {...pageProps} /> | ||
} | ||
function App({ Component, pageProps }) { | ||
return <Component {...pageProps} /> | ||
} | ||
|
||
export default wrapper.withRedux(MyApp) | ||
export default wrapper.withRedux(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
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