Commit graph

7213 commits

Author SHA1 Message Date
Cowboy Ho
28e12876b8
Fix router not working on some protocol (#16650)
Co-authored-by: Tim Neutkens <timneutkens@me.com>
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-11-03 16:18:02 -05:00
Joe Haddad
3c3379412e
v10.0.1 2020-11-03 15:42:54 -05:00
Steven
d4a92d92ba
Update example for Image Component (#18762) 2020-11-03 15:40:53 -05:00
Joe Haddad
89a3249f7c
v10.0.1-canary.7 2020-11-03 14:32:55 -05:00
JJ Kasper
f791577569
Ensure redirect from GS(S)P doesn't render (#18749)
This ensures we don't render the page un-necessarily when a redirect is returned from `getStaticProps` or `getServerSideProps`.

Possibly related: https://github.com/vercel/next.js/issues/18735
Closes: https://github.com/vercel/next.js/issues/18747
2020-11-03 16:40:50 +00:00
Eric Burel
b87b2d46ea
add rewrites in storybook preset (#18364) 2020-11-03 09:50:59 -05:00
Aral Roca Gomez
44ea598f88
Update next-translate example to support Next 10 with i18n routing (#18480)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-11-03 09:48:26 -05:00
Lee Robinson
4620dcc759
Update Gatsby migration guide to include next/image. (#18741)
Updates https://nextjs.org/docs/migrating/from-gatsby to mention the new `next/image` component released in Next.js 10.
2020-11-03 14:44:12 +00:00
Joe Haddad
27d7b76a39
Prevent Next.js from removing all of its styles on hydration (#18723)
Next.js would try to "recover" if its CSS assets went missing (i.e. a deployment occured) **while the page was initially loading**.

This handled a rare case where we'd try to let the Next.js complete hydrating even though a deployment occured.

However, in practice, this never worked: if the `fetch()` failed, that means the original assets never downloaded themselves (because the `fetch()` should be coming from disk cache).

Instead of letting Next.js get itself into a weird state, let's just stop hydration so that the page doesn't accidentally delete its styles.

The handle-no-styles behavior is already tested in `test/integration/css/test/index.test.js`. There was never a branch for it using its cached styles, so nothing else needs updated.

---

Fixes #17930
2020-11-03 12:50:15 +00:00
khades
b1503e13e8
Fix dynamic css unloading (#17173)
Serverside Dynamically loaded CSS module file insertion adds css-files as usual static files with special data-n-p tag, that is used in page transition logic. That files get removed on page transition cause they are not explicitly required in scope of page.

Mini-css-extract-plugin adds style tags at chunk insertion without any tags and leave them be, no matter how many page transitions were made.

I removed data-n-p tag from dynamically loaded css module files and added new data-n-d tag for it.

Fixes #16950
2020-11-03 05:23:31 +00:00
Joe Haddad
56bd464861
v10.0.1-canary.6 2020-11-02 22:31:17 -05:00
JJ Kasper
8277d4d5e3
Ensure multi-level basePath works properly (#18715)
This ensures the `basePath` property works correctly when a multi-level value is defined (`/hello/world`)

Fixes: https://github.com/vercel/next.js/issues/17889
2020-11-03 02:44:50 +00:00
Steven
2b94b1eea6
Update default widths configuration to handle 2x/3x DPI (#18717)
- Update default `deviceSizes`
- Add default `imageSizes`
- Use `layout` value to determine which `srcset` to use

Fixes #18420 
Closes #18714
2020-11-03 02:12:46 +00:00
JJ Kasper
3f84a55ba3
Ensure locale is added/stripped correctly (#18712)
This makes sure we don't incorrectly strip locale characters from the path if it is not a locale prefix e.g. `/fr` should not be removed from `/frank`. Additional tests have been added to ensure this isn't stripped for this case.

Fixes: https://github.com/vercel/next.js/issues/18332
2020-11-02 23:32:56 +00:00
JJ Kasper
7b6a61a750
Ensure correct locale is used for non-prefixed path (#18708)
When visiting a non-locale prefixed path (`/hello` instead of `/fr/hello`) we don't trigger locale redirects currently so if another locale is matched we need to ensure this is reset to the `defaultLocale` for rendering to prevent a mis-match on the client and the server.

This also fixes hydration errors from occurring with `asPath` for `getServerSideProps` pages due to `normalizeLocalePath` expecting only a pathname and `asPath` containing `hash` and `query values also. 

Fixes: https://github.com/vercel/next.js/issues/18337
Fixes: https://github.com/vercel/next.js/issues/18510
2020-11-02 23:00:41 +00:00
JJ Kasper
c8d26edf57
Allow passing statusCode for GS(S)P redirect (#18422)
This adds support for passing `statusCode` in a `redirect` from `getServerSideProps` or `getStaticProps` which matches the `redirect` shape allowed to be returned for `redirects` in `next.config.js`

Closes: https://github.com/vercel/next.js/issues/18350
2020-11-02 21:47:59 +00:00
JJ Kasper
d07b25a963
Add documentation for localeDetection: false (#18696)
Closes: https://github.com/vercel/next.js/issues/18694
2020-11-02 21:26:01 +00:00
JJ Kasper
a8d8f9aef9
Ensure localeDetection: false doesn't detect from header (#18695)
This ensures we don't detect the locale from the header when `localeDetection` is set to `false`

Fixes: https://github.com/vercel/next.js/issues/18482
2020-11-02 21:02:15 +00:00
JJ Kasper
faf4a0ab80
Ensure getStaticProps isn't called without params with i18n (#18702)
This corrects additional fallback pages being generated without the fallback flag causing `getStaticProps` to be called without params with i18n. The revalidation aspect of the issue has been corrected separately in https://github.com/vercel/next.js/pull/18569

Fixes: https://github.com/vercel/next.js/issues/18404
2020-11-02 20:41:34 +00:00
JJ Kasper
4e7835c95d
Ensure html lang is updating on locale transition (#18699)
This ensures the `html` tag's `lang` attribute is updated on client-transition when the locale is changing

Fixes: https://github.com/vercel/next.js/issues/18452
2020-11-02 18:54:20 +00:00
JJ Kasper
a529e6736f
Ensure preload works correctly with locale option (#18511)
* Ensure preload works correctly with locale option

* Fix conditional import

* Update size-limit tests

* DCE some code

* Resolve merge error

Co-authored-by: Tim Neutkens <timneutkens@me.com>
2020-11-02 11:22:40 -06:00
JJ Kasper
ee6b7cab4e
Update redirect and notFound GS(S)P documentation (#18690)
This updates the documentation with the new `redirect` and `notFound` return values adding `redirect` to the `getStaticProps` section and adding a new section describing the return values allowed for `getServerSideProps`

Closes: https://github.com/vercel/next.js/pull/18626
Closes: https://github.com/vercel/next.js/issues/18691
2020-11-02 16:58:13 +00:00
Joe Haddad
85e143e943
Rotate image from EXIF data (#18687)
Fixes #18643
2020-11-02 16:26:03 +00:00
Joe Haddad
2d5dbc480d
v10.0.1-canary.5 2020-11-02 09:00:01 -05:00
Carmelo Scandaliato
197d46ddb9
Remove the static optimization indicator (#18629)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-11-02 09:27:36 +01:00
Shun Kakinoki
fb58d95db7
fix: add missing dot to https://err.sh/nextjs (#18652)
Hi next.js team!
Was trying out the canary and came across the error!

The redirect to https://err.sh was to
`https://github.com/vercel/nextjs`, not
`https://github.com/vercel/next.js`
2020-11-02 02:02:28 +00:00
Steven
3fd1cc3ebb
Update 3rd party image loaders to prevent upscaling (#18647)
In PR #18147, we fixed the default loader to prevent upscaling images.

This PR fixes the same bug for 3rd party loaders.

---

Fixes #18648
2020-11-02 00:30:17 +00:00
Steven
377aa4b650
Fix image format for Safari and old browsers (#18646)
Older versions of Safari (and other browsers) do not support webp format so we were incorrectly falling back to png.

This PR fixes #18509 so that we fallback to the original image format if a modern format like webp was not explicitly provided in the Accept header.

Tests were added to ensure that the Accept header for Safari, Firefox, and Chrome work properly.
2020-11-01 23:53:36 +00:00
Joe Haddad
5c97b97755
Add default tags for issue templates (#18627) 2020-11-01 11:56:42 -05:00
Joe Haddad
4dbf0d47b0
v10.0.1-canary.4 2020-11-01 01:15:03 -04:00
Minh Tu Le
ec3e41c3cb
Fix Symbol.protype.description polyfill (#18575)
Our code uses `core-js` to polyfill and because core-js [`es.symbol.description`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.description.js#L14-L16) doesn't just check for `Symbol.prototype.description`, it will try to polyfill again but fail to do so because Next.js polyfill is not configurable. By default, `Object.defineProperty` set `configurable` to `false`. 

Here are the screenshots of the error on Edge 44.18362.449.0 using Next.js v10.0.1-canary.1
![Screen Shot 2020-10-30 at 9 44 05 PM](https://user-images.githubusercontent.com/1637627/97771409-da810700-1af9-11eb-8900-fe49d718dc94.png)

![Screen Shot 2020-10-30 at 9 51 43 PM](https://user-images.githubusercontent.com/1637627/97771433-321f7280-1afa-11eb-8928-fa4d902a01dd.png)
2020-11-01 05:11:56 +00:00
JJ Kasper
fb07e95847
Ensure correct params are used with i18n revalidation (#18569)
This makes sure we don't use invalid `x-now-route-matches` which can occur when `i18n` default locale is visited and a prerendered page is matched. To correct this we first check if we are able to derive the correct params from the URL and then bail on parsing `x-now-route-matches` if we are. Additional test cases are being added in the builder to ensure we don't regress on this

x-ref: https://github.com/vercel/next.js/discussions/18443
Fixes #18602
2020-11-01 04:49:48 +00:00
Jan Potoms
c0ae2041a1
Avoid calling setState in callback ref (#18589) 2020-10-31 23:37:28 -04:00
Lukáš Huvar
a6759c62ad
docs: fix missing comma in invalid redirect gssp (#18580)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-10-31 23:37:06 -04:00
Joe Haddad
f742b6d9bc
v10.0.1-canary.3 2020-10-31 22:52:19 -04:00
Steven
f8c32e556c
Add all deviceSizes to srcset for responsive and fill (#18594) 2020-10-31 20:26:57 -04:00
Joe Haddad
9569f5a31a
Deprecate Image unsized property and add layout="fill" (#18562)
This PR deprecates the `unsized` property from NextImage because the property did not accomplish the desired effect.

Users should rely on one of the new layouts instead:

- `<Image layout="fixed" />`
- `<Image layout="intrinsic" />`
- `<Image layout="responsive" />`
- `<Image layout="fill" />`

The `unsized` property will continue to work as-is in production but is deprecated and will throw in dev.

---

### TODO:
- [x] test `layout=fill` in typescript types
- [x] test `layout=fill` render behavior
- [x] test that `unsized` switches to `layout=fill`
- [x] test `next dev` erroring on `unsized`
- [ ] layout docs (tracked in issue #18554)
- [ ] both `layout=fill` and `layout=responsive` use all deviceWidths in the srcset

---

Fixes #18541 

Co-authored-by: Steven <steven@ceriously.com>
2020-10-31 18:34:06 -04:00
Joe Haddad
9de734a299
v10.0.1-canary.2 2020-10-31 16:03:23 -04:00
Daniel Treviño
a6660729ea
fix: issue #18360 - loading spinner not showing up (#18527)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-10-30 13:48:55 -05:00
ospira
3bbb35c323
small tweaks for those testing on an existing site with missing autho… (#18506)
* small tweaks for those testing on an existing site with missing author or featured image on posts

When migrating WordPress or using an exisitng site, sometimes you have published posts wth missing data. The graphql plugin will properly resolve these to null, but some of existing code accessing tries to access the node property on these null values. I've made these properties optional in the pages and also tweaked some of the components along similar lines.

* Lint fix

Co-authored-by: Luis Alvarez <luis@vercel.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-10-30 13:45:18 -05:00
Yudai Oriver K
61981da9e0
Fix i18n-routing Vercel deploy button URLs (#18524)
Fixes #18523

## description
The i18n-routing Vercel deploy button URLs was:
https://vercel.com/import/project?template=https://github.com/vercel/next.js/tree/canary/examples/amp

So, I fixed the URLs for examples/i18n-routing:
https://vercel.com/import/project?template=https://github.com/vercel/next.js/tree/canary/examples/i18n-routing
2020-10-30 15:44:21 +00:00
Steven
b7daae418b
Update install-sharp.md (#18508)
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
2020-10-30 10:56:11 -04:00
Steven
afa04d22db
Add layout prop to Image component (#18491)
This PR introduces a new `layout` property.

This allows 3 possible values (`fixed`, `intrinsic`, or `responsive`) which solve many use cases we have seen since 10.0.0 and will hopefully avoid usage of `unsized`.

Fixes #18351 

Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-10-30 10:33:34 -04:00
JJ Kasper
4263318836
Ensure i18n context values are provided for blocking 404 (#18513)
This ensures we provide the current `locale`, `locales`, and `defaultLocale` in the context when rendering the 404 for a blocking SSG page

Fixes: https://github.com/vercel/next.js/issues/18505
2020-10-30 01:42:28 +00:00
Yuji Matsumoto
629884af7d
Update using-preact example's dependencies (#18493)
- Update Next.js version to 10.0.0
- Update the other dependencies
- Modify `next.config.js` to prevent circular `__self` and `__source`in dev env (ref: https://github.com/developit/nextjs-preact-demo/issues/25)
2020-10-29 22:52:27 +00:00
JJ Kasper
598df6ac05
v10.0.1-canary.1 2020-10-29 13:02:21 -05:00
JJ Kasper
76504ebae3
Ensure custom routes handling with i18n (#18427)
This makes sure custom-routes function properly with i18n support. Since the `locale` is stripped from the `pathname` this re-adds when checking custom-routes to allow the locale to be matched against

Closes: https://github.com/vercel/next.js/issues/18349
2020-10-29 17:48:54 +00:00
Joe Haddad
50d98962c8
v10.0.1-canary.0 2020-10-29 09:34:20 -04:00
Joris W
7d4b36cccd
Fix GSP page titles in i18n-routing example (#18465) 2020-10-29 12:48:12 +01:00
yokinist
bb96fefa80
docs: Add description to i18n-routing (#18438)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2020-10-29 11:57:52 +01:00