1. 31 7月, 2018 1 次提交
  2. 30 7月, 2018 1 次提交
  3. 28 7月, 2018 4 次提交
  4. 26 7月, 2018 3 次提交
  5. 25 7月, 2018 3 次提交
    • T
      Compile pages to .next/static directory (#4828) · 475b426e
      Tim Neutkens 提交于
      * Compile pages to .next/static/<buildid>/pages/<page>
      
      * Fix test
      
      * Export class instead of using exports
      
      * Use constant for static directory
      
      * Add comment about what the middleware does
      475b426e
    • T
      update with-flow example (#4835) · c090a57e
      Tomek 提交于
      Changes:
      * updated packages
      * moved the content of `layout` to `_app.js` and created simple `Page` component
      * replaced `import * as React` because it is not necessary to import everything
      * moved `next.js.flow` to `flow-typed` as it is default directory for library definitions
      * updated the gif
      c090a57e
    • T
      update with-asset-import example (#4830) · d1fbcfe5
      Tomek 提交于
      Changes:
      - use `next-images` plugin for handling static files import
      d1fbcfe5
  6. 24 7月, 2018 3 次提交
  7. 23 7月, 2018 1 次提交
  8. 22 7月, 2018 3 次提交
  9. 21 7月, 2018 1 次提交
  10. 20 7月, 2018 1 次提交
    • B
      improve custom-server-fastify example (#4805) · 0298c722
      Brian Kim 提交于
      I’ve been experimenting with Next.js and Fastify and I made the following changes to the Fastify example based on what I found:
      
      ### Use Fastify’s plugin API
      IMO putting Fastify’s listen call in a promise callback is an anti-pattern, b/c the Fastify plugin API is meant to solve the problem of async server bootstrapping.
      
      [From Fastify’s Getting Started docs](https://www.fastify.io/docs/latest/Getting-Started/):
      > Fastify provides a foundation that assists with the asynchronous bootstrapping of your application.
      
      ### Set reply.sent in handlers which return promises
      
      [From Fastify’s Routes docs](https://www.fastify.io/docs/latest/Routes/#promise-resolution):
      > If your handler is an `async` function or returns a promise, you should be aware of a special behaviour which is necessary to support the callback and promise control-flow. If the handler's promise is resolved with `undefined`, it will be ignored causing the request to hang and an *error* log to be emitted.
      >
      > 1. If you want to use `async/await` or promises but respond a value with `reply.send`:
      >     - **Don't** `return` any value.
      >     - **Don't** forget to call `reply.send`.
      > 2. If you want to use `async/await` or promises:
      >     - **Don't** use `reply.send`.
      >     - **Don't** return `undefined`.
      
      `app.render` returns a promise which contains undefined, so returning it in a Fastify handler will log an error. However, returning anything besides undefined will cause Fastify to try to write to the response which Next.js has already ended. The solution is to manually set the `reply.sent` flag to true when any Next.js rendering promise is fulfilled as an alternative to calling `reply.send`.
      
      ### Make Next.js handle 404 errors
      This allows any route to throw a NotFound error and let Next.js handle the rendering of the 404 page.
      
      ### Make Next.js handle any route which starts with `_next` in dev
      This prevents dev routes from being caught by user-defined routes.
      0298c722
  11. 19 7月, 2018 3 次提交
  12. 17 7月, 2018 1 次提交
  13. 16 7月, 2018 1 次提交
  14. 14 7月, 2018 2 次提交
  15. 13 7月, 2018 2 次提交
  16. 12 7月, 2018 3 次提交
    • J
      Respect `target` on <a/> tags under Link (#4763) · 1a3f9507
      James Reggio 提交于
      There are occasions where it is useful to have `target='_blank'` on hyperlinks within your own app. (For example, if your app is being loaded in an iframe and you'd like for the links to break out in to new windows.)
      
      With this PR, the `onClick` logic in Link now checks for an external target on the nested <a/> tag, and will fall back to the default behavior if it's present, similar to the logic for shift-/cmd-clicking the link.
      1a3f9507
    • J
      Fix #4574: getInitialProps is not called on _error page for client-side errors (#4764) · 4cc691c0
      James Reggio 提交于
      ## What's wrong
      
      This problem is specific to errors that happen on the client _after_ the initial mounting of the component. (The router has special logic to handle exceptions thrown in `getInitialProps` during a client-side navigation, and I've confirmed this logic is correct.)
      
      Specifically, if the page is mounted, and you raise an exception on the page, the exception will cause  the error page to be mounted without ever invoking `getInitialProps` on the new App/Error page pairing.
      
      This has been illustrated with multiple repros in #4574.
      
      ## Why is it broken
      
      This regression was introduced two months ago in #4156, where the invocation of `getInitialProps` was removed from the app's top-level error handler. Specifically, [this line](https://github.com/zeit/next.js/pull/4156/files#diff-895656aeaccff5d7c0f56a113ede9662L147) was removed and [replaced by a comment](https://github.com/zeit/next.js/pull/4156/files#diff-895656aeaccff5d7c0f56a113ede9662R167) that says that "`App` will handle the calling of `getInitialProps`".
      
      I believe the sentiment about "`App` will handle calling `getInitialProps`" is mistaken. In fact, it really doesn't make sense on its face, since it would require an instance lifecycle method of `App` (which is mounted immediately after the comment) to invoke the `static getInitialProps` method on the error page.
      
      ## How I fixed it
      
      I've fixed this in a fork by restoring Lines 146 – 148 that were removed in #4156. I think this is the right fix, but Next.js's handling of `getInitialProps` could certainly be improved. (The code in [this conditional](https://github.com/zeit/next.js/blob/86d01706a67cee5c80796974d04c1e11cdff453a/client/index.js#L173) speaks to the unnecessary complexity around this.)
      4cc691c0
    • M
      #4751 - Explicitly mention install when cloning examples (#4758) · 5b3578e5
      Michael Herold 提交于
      Preferably this installation wouldn't be necessary, but in lieu of a fix...
      
      #4751
      5b3578e5
  17. 11 7月, 2018 2 次提交
  18. 09 7月, 2018 1 次提交
  19. 07 7月, 2018 2 次提交
  20. 06 7月, 2018 2 次提交
    • B
      Prepend polyfills only once (#4643) (#4738) · d7d61d3d
      Brendan Houle 提交于
      d7d61d3d
    • N
      Apollo example: avoid double render in browser (#4734) · 728871b0
      NikitaVlaznev 提交于
      Apollo's getDataFromTree is supposed to be called during the server side rendering.
      Being called in browser it fires an unnecessary fake render process and blocks components from rendering with loading=true.
      
      Also there was a mistake in this code:
      
          // `getDataFromTree` renders the component first, the client is passed off as a property.
          // After that rendering is done using Next's normal rendering pipeline
          this.apolloClient = props.apolloClient || initApollo(props.apolloState.data)
      
      **Apollo** component is not rendered by getDataFromTree actually, it renders the **App** directly, thus props.apolloClient will always be undefined.
      
      This example was discussed here: https://github.com/zeit/next.js/issues/387.
      728871b0