1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
Commit graph

2760 commits

Author SHA1 Message Date
Zach Curtis 829f4e581c Fixed auth token not getting refreshed on client cache reset (#5471) 2018-10-17 16:52:29 +02:00
Luc 6f80581adc Update styled-components to v4 (#5458) 2018-10-16 12:03:25 +02:00
Iurii Kucherov 619ba00001 Fix typos on comments (#5457)
Hello,

Here is a small PR to fix some typos on the comments.
2018-10-16 01:25:16 +02:00
Jan Czizikow 9d50f8afb5 Update using emotion - fixes: Warning: <title> should not be used in _document.js's <Head> (#5454) 2018-10-15 17:02:19 +02:00
Don Alvarez af9214b302 mobx-state-tree examples should use _app (#5362)
The mobx-state-tree examples (with and without typescript) pre-dated the next _app class and needed to be updated to use _app for persisting state across client-side navigation transitions. Also removed unneeded custom server class to better keep with the "show one feature per example" style of the next examples folder
2018-10-14 10:04:58 +02:00
zsx 1b8bfc70f3 Fix the bug with creating duplicate components of with-rematch example (#5440) 2018-10-12 16:16:52 +02:00
Henrik Wenz 95a6a872b6 Refactor test setup (#5391)
- [x] Move jest config from npm scripts to `jest.config.js`
- [x] Remove obsolete cross-env package (we don't need it anymore 🎉)
- [x] Fix bug where tests are not waiting for webdriver to be ready.
2018-10-12 15:32:17 +02:00
Henrik Wenz d4785eb013 Fix coverage (#5435)
* removed nyc in favor of jest
* fixed coverage
2018-10-12 14:38:35 +02:00
Rafael Almeida 449dd29da0 Update with-react-i18next example to use react-i18next@8.0.6 (#5368)
Fixes #5352 . This updates the example updating react-i18next to v8.0.6, replacing the `translate` HOC to `withNamespaces` and `I18n` to `NamespacesConsumer`.

There is one thing that I am not sure if is correct or not so I need some guidance. You gotta wrap the page with the `withI18next` HOC so it will extend the `getInitialProps` of the page with this:

```
Extended.getInitialProps = async (ctx) => {
  const composedInitialProps = ComposedComponent.getInitialProps
    ? await ComposedComponent.getInitialProps(ctx)
    : {}

  const i18nInitialProps = ctx.req
    ? i18n.getInitialProps(ctx.req, namespaces)
    : {}

  return {
    ...composedInitialProps,
    ...i18nInitialProps
  }
}
```

The problem lies in `i18n.getInitialProps` that has this code:

```
i18n.getInitialProps = (req, namespaces) => {
  if (!namespaces) namespaces = i18n.options.defaultNS
  if (typeof namespaces === 'string') namespaces = [namespaces]

  req.i18n.toJSON = () => null // do not serialize i18next instance and send to client

  const initialI18nStore = {}
  req.i18n.languages.forEach((l) => {
    initialI18nStore[l] = {}
    namespaces.forEach((ns) => {
      initialI18nStore[l][ns] = (req.i18n.services.resourceStore.data[l] || {})[ns] || {}
    })
  })

  return {
    i18n: req.i18n, // use the instance on req - fixed language on request (avoid issues in race conditions with lngs of different users)
    initialI18nStore,
    initialLanguage: req.i18n.language
  }
}
```

In my understanding, among other things, it gets the `i18n` object from the request (included by the `server.js`) and uses the data to create `initialI18nStore` and `initialLanguage`, and then return these two objects plus the `i18n` object itself. If you add the `i18n` object on the return, then there will be a crash on the client-side render of the page:

```TypeError: Cannot read property 'ready' of null```

I don't know why, but returning it breaks `NamespacesConsumer` component from `react-i18next` (the state becomes null). So I commented this line and the provider on `_app.js` is getting the `i18n` instance from the `i18n.js` file (the same as `server.js`). I don't know if this would be an issue so I would like help to debug this.
2018-10-11 16:20:01 +02:00
Tim Neutkens 384fbdc3aa v7.0.2-canary.9 2018-10-11 11:42:53 +02:00
Tim Neutkens 965f50beb2
Remove pathname (#5424) 2018-10-10 21:58:15 +02:00
Adam Stankiewicz 299cc65d21 Show that <Head /> is needed for custom document (#5376)
* Show that <Head /> is needed for custom document

* Add comment explaining required Document fields

* Update README.md
2018-10-10 12:00:02 +02:00
Henrik Wenz 61fe50a493 Update husky & lint-staged (#5389)
* Update husky & lint-staged

* Move to pre-commit package

* Include bin files

* Remove husky
2018-10-10 11:58:44 +02:00
Luc e174304639 Remove examples/.babelrc (#5415)
* fix relative path in examples/.babelrc

* remove examples/.babelrc

* remove examples/.gitignore
2018-10-10 09:52:48 +02:00
Kenneth Luján Rosas 6dcc9bd59a feat: add dynamic layouts with _app.js example (#5420)
Regarding a question about having different global layouts via `_app.js` usage, it came up that we could use a static property in the page that needed a different one(Thanks @timneutkens )

Link to the Spectrum post: https://spectrum.chat/?t=af6ca794-5420-4780-abd8-96f085a19e09

This PR adds an example called `with-dynamic-app-layout`, that showcases that use case in the simplest way I could think of.

Let me know if there's changes or improvements to be made. 🎉
2018-10-10 09:49:22 +02:00
Duncan L d141b95603 Examples: Update with-typescript Example Packages (#5410)
Update packages for with-typescript example
2018-10-09 12:48:27 +02:00
Duncan L 6d5389ef2d Examples: Update custom-server-typescript examples packages (#5411) 2018-10-09 12:48:05 +02:00
Duncan L 5fbca72ea2 Examples: Update with-redux-observable example packages (#5412) 2018-10-09 12:47:26 +02:00
Luc 91b21f9514 Update with-jest example .babelrc config (#5414)
* simplify babelrc

* simplify "test" script

* update dependencies
2018-10-09 12:45:51 +02:00
Shu Ding 409cf71a4d Move styled-jsx to external modules (#5403) 2018-10-08 16:26:05 +02:00
Henrik Wenz 8ac4561745 Remove AppVeyor artefacts (#5398) 2018-10-08 14:06:09 +02:00
Luc c178481611 Remove @babel/runtime devDependencies in next-server (#5360)
* Move @babel/runtime to dependencies

* Remove @babel/runtime, keep @babel/runtime-corejs2
2018-10-07 21:22:47 +02:00
Romello Goodman fad1265d17 Upgrading the styled component packages (#5390)
Upgrading the styled-components and babel styled components packages!
2018-10-07 15:32:31 +02:00
Henrik Wenz ef01f13e5d Improve test setup (#5388)
* Update jest

* Let jest start chromedriver

This makes sure chromedriver always ends even if the test was canceled by the user.

* Properly close browser in production-config test

* Properly close browser in production/security test

* Properly close browser in export test

* Properly close browser in app-aspath test

* Remove taskr from project root

This isn’t needed anymore

* Readd taskr to project root (temporary)

* Improve global setup/teardown

* Properly close browser in basic/client-navigation test

Clicking an target=_blank link will open a second browser window. We can only close this by using broser.quit()
2018-10-07 15:04:43 +02:00
Logan McAnsh f3c65fd417 update polka example (#5370)
[polka](https://github.com/lukeed/polka/releases/tag/v0.5.0) changed their listen api to be more like express like
2018-10-07 15:00:44 +02:00
Tim Neutkens 14fad91084 Use correct link to contributing.md 2018-10-06 07:35:27 +02:00
Tim Neutkens 4e73c12341 Move contributing.md to the top level 2018-10-06 07:34:09 +02:00
Tim Neutkens 51577eac1a Update contributing.md with the new way of running build 2018-10-06 07:32:50 +02:00
Tim Neutkens ae4c1bc5d0 Link image to nextjs.org 2018-10-06 06:18:50 +02:00
Supakorn Thongtra fef6026ad9 <title> should not be used in _document.js's (#5379)
* <title> should not be used in _document.js's

* fix style as it was
2018-10-05 23:53:52 +02:00
Tim Neutkens ee696683ca v7.0.2-canary.8 2018-10-05 23:41:38 +02:00
Tim Neutkens 0f6cff88bc Add next-to-next-server 2018-10-05 23:40:36 +02:00
Tim Neutkens 93586573e8 v7.0.2-canary.7 2018-10-03 02:38:07 +02:00
Tim Neutkens 42c0af99ad Add index.js to files key 2018-10-03 02:37:36 +02:00
Tim Neutkens 85c3ac94b8 v7.0.2-canary.6 2018-10-03 00:10:59 +02:00
Tim Neutkens 785377d3c3
Add missing dependencies to server (#5369)
- compile default pages correctly into `.next`
- add missing runtime dependencies
2018-10-03 00:08:57 +02:00
Tim Neutkens de6d394d73 Use correct server path since main was changed 2018-10-02 23:11:01 +02:00
Tim Neutkens d2cbabbae4 Make next-server expose the same handler function as next 2018-10-02 19:08:30 +02:00
Tim Neutkens e3ef917077 v7.0.2-canary.5 2018-10-02 17:11:00 +02:00
Tim Neutkens 8db40b644f Add npmClient for publish command 2018-10-02 17:10:07 +02:00
Tim Neutkens 3246c32f63 v7.0.2-canary.4 2018-10-02 16:55:08 +02:00
Tim Neutkens 57c61cde3a Use yarn to correctly pass through arguments 2018-10-02 16:54:36 +02:00
Tim Neutkens b1d8d775ee v7.0.2-canary.3 2018-10-02 16:16:22 +02:00
Tim Neutkens f9d54c1336 Add yes to publish command 2018-10-02 16:16:03 +02:00
Tim Neutkens 3f5524abd3 Disable publish on branch builds 2018-10-02 16:06:49 +02:00
Tim Neutkens 85b1c1a6b6 v7.0.2-canary.2 2018-10-02 16:02:57 +02:00
Tim Neutkens 61b93e5291 Install deps to publish 2018-10-02 15:54:20 +02:00
Tim Neutkens 41a570f59a v7.0.2-canary.1 2018-10-02 15:38:22 +02:00
Tim Neutkens 2e01b3d34a Add files key to next-server 2018-10-02 15:24:46 +02:00
Tim Neutkens be5dbe3cfd Persist dist directory under packages 2018-10-02 15:12:28 +02:00