Commit graph

764 commits

Author SHA1 Message Date
Ting-Hsiang Hsu
21d5aebd53 feat(example): add react-relay-network-modern example (#5349)
In this example, we can:
- `QueryRenderer` SSR
- caching the data
- use the feature of `react-relay-network-modern` which is the powerful tool for `relay-modern`

I copy the example `with-relay-modern`, but I just modified the code. Some detail are not modified.
If you think this example is needed, I will fix those. Otherwise, close this **PR** to let me know this example is not needed.
2018-11-25 15:14:36 +01:00
Obed Marquez Parlapiano
b63487c331 Update with-firebase-auth example (#5742)
- The with-firebase-auth example won't run unless a database with proper rules is created first. 
- Add a small error callback to addDbListener to help with debugging if someone's database connection doesn't work.
2018-11-25 14:57:15 +01:00
Hozefa
401594ed36 remove glamorous example since its no longer maintained (#5738)
Since glamorous is [no longer maintained](https://github.com/paypal/glamorous#status-unmaintained) removing it from readme.
2018-11-23 21:18:13 +01:00
Matt Jewell
7076727d3e Fix location of production server file (#5731)
(At least with my set up, mac osx, node 10.13.0, yarn 1.12.1)

Couldn't get the server to start with `npm start`, this appears to fix that
2018-11-22 16:55:47 +01:00
Darryl
f177be9e05 Fix bug report with-portals example #5694 (#5714)
I'm trying to contribute on resolving issues,
hope this help.

Fixes #5694
2018-11-21 09:25:00 +01:00
Már Örlygsson
766d7d5fe4 Run initializeStore() only once per route on server (#5644)
On the server `props.initialMobxState` received by the `constructor` is a fully functioning mobx store that was instantiated by `getInitialProps()` only a few ticks earlier.
Thus, creating a new instance is unneccessary.

In the browser, however, `props.initialMobxState` is a hydrated plain object and thus the store needs to be initialized.
2018-11-20 15:53:28 +01:00
paulogdm
e5d8eb2374 Update README.md (#5698)
Fixes #5680
2018-11-18 20:45:22 +01:00
Luc
74abf25396 remove <title> in _document.js in examples (#5679) 2018-11-15 16:31:56 +01:00
luffyZhou
8ed7795495 update && optimize with-ant-design-less example (#5658)
Current with-ant-design-less example has some problems.

- Upgrade next7, console found a 404 error.
![](https://user-gold-cdn.xitu.io/2018/11/11/167015fb80017e79?w=2606&h=1000&f=jpeg&s=124801)
  > After upgrade next7, .next folder didn't find /static/style.css and there is /static/css/style.chunk.css.
- The /_next/static/style.css link don't need be placed in the <Head> tag. The style.chunk.css file will be add in the head tag automatically after build.
- The project with more pages include _app.js, _document.js...the antd-custom.less will not work well.
  > The solution is use `modifyVars` of  `lessLoaderOptions`. It work well in my project~
2018-11-11 18:09:30 +01:00
Adam Lane
b36382bb83 update with-reasonml dependencies (#5651) 2018-11-10 08:09:51 +01:00
Jamie Barton
196f71feb7 Refactor with tailwindcss example to use next-css (#5461)
Instead of bundling `postcss-cli` we can now make use of `@zeit/with-css`.

This also means we can get rid of the `<style>` import and concurrent build step for css. 🎉
2018-11-08 14:42:55 +01:00
Tim Neutkens
ed2c379fc7
Simplify styled-components example (#5631)
- use `enhanceApp` so that styled-components used in _app.js are server rendered
- call parent getInitialProps, fixes #5629
- return `styles`, making the render() method obsolete.

cc @mxstbr @probablyup
2018-11-08 12:43:16 +01:00
Giuseppe
76d534881f Add with-external-styled-jsx-sass (#5618)
because of this https://twitter.com/rem/status/1059563246007566336
2018-11-07 18:42:44 +01:00
Davide Curletti
819efed2c0 Fix incorrect path for ts server example (#5612)
The customer-server-typescript example has a bug where the `yarn start` command has the incorrect path to the server entry point file.
2018-11-07 14:33:33 +01:00
Már Örlygsson
420f74c867 examples/with-mobx : Fix and simplify (#5537)
I spent far too much time fiddling with this example project before realizing it contained a bug in the store initialization logic and it was a bit more complex than it needed to be.

* The custom server was not needed
* The store-initialization did effectively the same thing twice for no reason
* And wrapping MyApp component in a HOC was wholly unnecessary indirection

My changes are split into four discrete commits for clarity.
2018-11-06 10:18:26 +01:00
Rafael Cossovan
14668aa3ee Update next.config.js (#5593)
Tests using a case insensitive expression.
Fixes assets output folder.
Reduce `limit` so we can use `file-loader` on larger files.
2018-11-04 19:42:53 +01:00
AJ Livingston
cb312eb18b Examples: with-typings-for-css-modules (#5446)
* added example for using typings-for-css-modules-loader

* Update examples/with-typings-for-css-modules/README.md

* Update examples/with-typings-for-css-modules/README.md

* Update examples/with-typings-for-css-modules/next.config.js
2018-11-02 23:21:59 +01:00
Henrik Wenz
dccbc1ea35 Update examples/with-antd-mobile (#5495)
* Update examples/with-antd-mobile

- Reduced noise
- Simplify setup

* Create more more complex example
2018-11-02 19:50:30 +01:00
Giuseppe
c95abc209b Add with style-sheet example (#5572)
* Remove pathname (#5428)

Same as #5424

* fix typo (#5451)

* Add with style-sheet example

* Fix readme

* Fix typo
2018-11-01 14:05:39 +01:00
Anton Moiseev
e8a9472bcd Remove broken link from progressive-render example (#5552)
- Looks like no other example provides a link to a hosted demo
- There is the "Deploy to now" badge, so it can be deployed on demand when needed
- The link is broken anyway
- Probably any example hosted by an individual contributor sooner or later will be cleaned up, doesn't feel like a reliable way to provide a live demo
2018-10-30 11:35:41 +01:00
Anton Moiseev
58583a2b81 Examples: fix <title> warning in the TypeScript example (#5549)
* Replace _document.tsx example with _app.tsx

* Fix title

* Remove _app.tsx
2018-10-29 19:32:01 +01:00
Janek Rahrt
a7b6ffa914 Fix ssr auth bug and dependency problems (#5543)
* fix graphql dep

* fix ssr auth bug

* fix linting issues
2018-10-28 13:13:28 -07:00
Quentin Sommer
def2ce7eda feat: Added react-useragent example (#5507)
Add an example how to use `@quentin-sommer/react-useragent` with next.

I've been asked this https://github.com/quentin-sommer/react-useragent/issues/10 and plan to link this example as reference!

See readme for details
2018-10-23 23:33:41 +02:00
David Calhoun
ba5f1b2c21 [change] Update react-native-web example (#5489)
Utilize ES modules, which are now the default export for
`react-native-web`.

_NOTE:_ [This example requires `next@^7.0.0`](https://bit.ly/2PaEhao).
2018-10-22 22:32:24 +02:00
Christopher Lee
98eb710189 removed deprecated useBuiltIns from .babelrc (#5486) 2018-10-20 21:09:03 +02:00
ultrox
2ce3f39585 fix(examples/with-react-intl): Bug when accept-language is anything other then 'en' (#5488)
package accept returns false if can't find language in offered list of languages, then later on
bool is attempted to be split, and app crashes in prod & dev
2018-10-20 20:11:59 +02:00
Tim Neutkens
e8c73b45fa Run yarn lint —fix 2018-10-20 19:37:42 +02:00
Henrik Wenz
18488f47b0 Fix linter (#5350)
* Fix linter

* Add test env

* Fix lint errors
2018-10-20 17:00:01 +02:00
Anthony Cerbic
4be4452fd8 Add cloud9 (c9.io) to examples (#5448) 2018-10-20 16:58:21 +02:00
komkanit
3e72da686f upgrade react-native-web to fix bug (#5459) 2018-10-20 16:58:03 +02:00
zsx
5b6489ebf3 Fix the bug with not passing props to wrapped element of with-rematch example (#5483) 2018-10-20 14:31:26 +02:00
Seth Bergman
f5156b2297 Fixed broken link (#5479)
Fixes link to 404 page in sentry docs
2018-10-19 14:52:41 +02:00
Jerome Fitzgerald
6eba3ad9ab 🐳️ multistage: remove devDependencies (#5477)
Docker Multistage
* Remove `devDependencies` from `./node_modules`
 in `builder` for faster copy on `base` init

* Added `isomorphic-unfetch` to show it not
 being copied over to `base`.

* `isomorphic-fetch` will still show from `next`
2018-10-19 00:36:04 +02:00
Gerhard Preuss
9634bad79d Remove note on OSS/non-OSS issue (#5474)
I successfully deployed this example with `now` and `now --public` (I am on premium plan).
Did this before deploy

```sh
$ cp Dockerfile.multistage Dockerfile
```
2018-10-18 11:14:17 +02:00
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
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
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
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
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
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