Commit graph

960 commits

Author SHA1 Message Date
Mohamed ElSaadany
e4f66fe911
Adds <link rel="preconnect" ... /> to example optimized font output (#36529)
This makes it clear that the font optimization adds these for you.
This avoids duplicate `<link rel="preconnect" />` in the HTML output if the developer is unaware that it is being added automatically.



## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-04-28 00:04:18 +00:00
Lee Robinson
ea0456dc07
Add docs on self-hosted ISR persisting across pods. (#36520)
ISR works self-hosted, but there's some more guidance needed when hosting with container-based setups (e.g. Kubernetes) and how the files are shared between different pods. This was based on community feedback. Please let me know if you'd like to see any additions here! 🙏
2022-04-27 23:38:08 +00:00
Alex Castle
93d8fac184
Always add height and width prop to image with layout="raw" (#36523)
This PR makes the following changes:
* Always add the `height` and `width` prop to image with `raw` layout (previously only added to images without `sizes`)
* Add a warning if a raw layout image is getting stretched (which can be caused by interaction of height and width prop with styles)
* Remove automatic aspect-ratio style from `raw` images. This is no longer necessary if all `raw` images have height and width props.
* Update tests and docs accordingly
2022-04-27 21:59:05 +00:00
Luis Alvarez D
ff140a7291
Update usage paragraph of next/script onLoad (#36453)
Changing the paragraph to not include `beforeInteractive` as one of the possible use cases of `onLoad`.

*Update:* Added docs for `onError` in the API reference of `next/script`.

@housseindjirdeh does `onError` also has the same limitation or is this only for `onLoad`?

Closes https://github.com/vercel/next.js/issues/33402

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-04-25 17:51:35 +00:00
JJ Kasper
e832007536
Revert "Change getStaticProps to getStaticPaths in getStaticPaths docs" (#36425)
This change was un-necessary and `getStaticProps` was correct here so this reverts the change. 

Reverts vercel/next.js#36403
2022-04-25 03:33:36 +00:00
youngvform
2a42de2fd1
Change getStaticProps to getStaticPaths in getStaticPaths docs (#36403)
## Overview
The subject is `When does getStaticPaths run` but this docs denotes about `getStaticProps`.
So could you check `getStaticProps` is right?

## Documentation / Examples

- [X] Make sure the linting passes by running `yarn lint`
2022-04-23 14:41:03 +00:00
Maedah Batool
60488e68e3
Fix broken data fetching links in docs (#33766)
* Fix broken links for Data Fetching

* Fix link data fetching doc

* Improve link file paths

* Update errors/large-page-data.md

Co-authored-by: Steven <steven@ceriously.com>

* Update links

* Fix linting

* Lint tests

* Lint tests

Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2022-04-22 14:03:07 +02:00
Janicklas Ralph
0441f816a6
Changes to the beforeInteractive strategy to make it work for streaming (#31936)
Changes to the beforeInteractive strategy to make it work for streaming

Splitting `beforeInteractive` into two strategies `beforeInteractive` at the _document level and `beforePageRender` for page level <Scripts>
2022-04-21 21:15:53 +00:00
Joshua Davis
5a93e211cb
Clarifies that path params exist on query object (#36321)
Clarifies that the query object contains query and dynamic path parameters. As I was helping another engineer, I tried to reference this documention. I thought the routing page would be a more useful reference if it indicated how to read path parameters.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-04-20 23:04:43 +00:00
Daniil Grishkin
49820daca6
Fix introduction.md for next.config.js (#36286)
Fix line in link to interface `NextConfig` where describe `next.config.js` properties.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-04-19 20:35:49 +00:00
David Barker
44c7fd7999
Add onLoad gotcha note to basic-features doc (#36261)
#33097 adds a note to the `Script` documentation explaining that `onLoad` cannot be used with the `beforeInteractive` strategy. However, this note was missing in the [Basic Features](https://nextjs.org/docs/basic-features/script) documentation, causing some confusion. This adds the note there too.

This will hopefully fix a lot of confusion noted in https://github.com/vercel/next.js/issues/33191.
2022-04-19 11:50:19 +00:00
Jim Fisher
a2e65ac6d8
Docs: workarounds for router not resetting state (#35651)
* Docs: workarounds for router not resetting state (fixes #35138)

* Apply suggestions from code review

* updates

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-04-15 21:56:38 -05:00
Basant
ec7c911295
fixed typo, that should say 'in' not 'from' (#36046)
we can import server or client components in any server component, not from it.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`


Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-04-15 15:34:21 +00:00
Eric Burel
e69820accc
Loosen the "public" condition on getSSP (#36018)
<!--
Thanks for opening a PR! Your contribution is much appreciated.
In order to make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below.
Choose the right checklist for the change that you're making:
--

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
** I've made the change via GitHub UI sorry :)**

Hi, 

I think the "data must be public" condition on getSSP is not really true, and even counter-productive. Being able to statically render more content is most probably positive, in terms of perceived and real performance of the app + energy consumption. It's actually totally possible, and not even that hard thanks to middleware, to statically render custom, paid, segment-specific content (and even individual-specific content under certain conditions).

I've documented the reason for this change in a few places if you want more details:
- related PR on React: https://github.com/reactjs/reactjs.org/pull/4566
- demo implementation and explanation on how to couple middlewares and getSSP to statically render any kind of content (including custom content): https://blog.vulcanjs.org/render-anything-statically-with-next-js-and-the-megaparam-4039e66ffde
2022-04-15 13:23:32 +00:00
Balázs Orbán
c0f979b5c8
Update upgrading.md (#36091) 2022-04-15 14:43:26 +02:00
Aman Mittal
4726b5a618
Add instructions to create pages directory and add an index.js file to it (#35971)
* Update from-create-react-app.md

* Update from-create-react-app.md

* Fix typo

* Update docs/migrating/from-create-react-app.md

Co-authored-by: Lee Robinson <me@leerob.io>

* Update docs/migrating/from-create-react-app.md

Co-authored-by: Lee Robinson <me@leerob.io>

* Update from-create-react-app.md

* fix lint-language issue

* Update .alexrc

* Update docs/migrating/from-create-react-app.md

Co-authored-by: Steven <steven@ceriously.com>

* Update from-create-react-app.md

* Update docs/migrating/from-create-react-app.md

Co-authored-by: Steven <steven@ceriously.com>

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Steven <steven@ceriously.com>
2022-04-15 14:40:37 +02:00
Rich Haines
d38a46e2e4
Revert "Improvements to the MDX Docs and replaced a leftover reference to babel" (#36066)
Reverts vercel/next.js#35332
2022-04-11 16:11:35 +00:00
Amy Burns
9a7d175915
Moving middleware file (#36009)
This PR fixes a request from `@rauchg` that we specify more clearly that Middleware is Beta and organize it properly within the navigation. 

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-04-11 14:01:14 +00:00
Markos-Th09
5bf7265c35
Improvements to the MDX Docs and replaced a leftover reference to babel (#35332)
* Added next.config.mjs for @next/mdx

* Replaced leftover reference to babel

* Fixed formatting problem

* Added next-mdx-remote and @mdx-js/mdx as options
2022-04-11 12:21:43 +02:00
JJ Kasper
a0924fc7c7
Add docs for x-nextjs-cache header (#36023)
This adds documentation for the `x-nextjs-cache` header which is now exposed for ISR pages and image optimization requests to help signal the cache state. 

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`

Co-authored-by: Steven <steven@ceriously.com>
2022-04-08 17:38:50 -04:00
Shu Ding
3d4f4c6995
Update the docs for Switchable Runtime (#36015)
As per the feedback in #35952.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-04-08 16:26:14 +00:00
Björn
9c12d85c5d
Mention HTTP 303 See Other in redirects section (#35997)
Migrating from express to nextjs API routes broke one of our APIs because of how `redirect` works in nextjs vs. how it works in express. We need to redirect the user to a confirmation page via GET after making a POST request, which is not possible with `redirect`.

HTTP 303 seems to be the way to go in that case and I think it should be mentioned here.


## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-04-08 15:52:34 +00:00
Shu Ding
1c92591466
Update docs related to React 18 (#35952)
* update docs of streaming

* add switchable runtime docs

* add page to manifest

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>

* Update docs/advanced-features/react-18/streaming.md

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Steven <steven@ceriously.com>
2022-04-08 17:09:55 +02:00
Francis Gulotta
5feb400aff
docs: clarify when you use getServerSideProps (#35922)
Removed the misleading TTFB information. It was easy to read that incorrectly and while getStaticProps does have a better TTFB that's not why you might need to avoid getServerSideProps, I gave better examples. 

I also wanted to answer "well how do I cache `getServerSideProps`?" and now there's a link.

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-04-07 22:00:28 +00:00
Sølve Tornøe
07723be8b3
Refactor default locale prefix to support clone() (#35874)
## Bug
fixes https://github.com/vercel/next.js/issues/35273

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`


## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-04-06 15:00:39 +00:00
白宦成
5a627019e9
fix: toBeInTheDocument is not a function (#35930)
fix when run jest with error "TypeError: expect(...).toBeInTheDocument is not a function"



![image](https://user-images.githubusercontent.com/13283837/161903133-501f6f6b-8623-4b1f-986f-0faa32b3ef91.png)

## Feature
- [x] Documentation added

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-04-06 13:13:45 +00:00
Aman Mittal
5429e8f12e
Update Manual Steps in Getting Started guide (#35898)
This PR add necessary information to the Manual Section to add directories such as `pages` and `public`.

## Bug

- [x] Related issues linked using fixes #29479 
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-04-06 13:06:50 +00:00
Lee Robinson
686a0f598a
Add Vitest example. (#35858)
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-04-04 18:25:56 +00:00
Lee Robinson
bcd2aa5c12
Link to with-docker-multi-env example. (#35820)
Based on feedback from Twitter to surface this more. A small improvement before improving the deployment docs further 😄
2022-04-01 15:45:22 +00:00
TianenPang
fbfe430cf0
Docs: update react 18's overview (#35766)
React 18 is now released and will have the following updates to the react 18 `overview` documentation

- Links
- Descriptions 
- Installation command
2022-03-31 07:46:06 +00:00
Steven
9f9214abe5
Updated create-next-app docs to include pnpm usage (#35755)
This PR updates the docs and examples for `create-next-app` to include pnpm usage.

The following script was used to update every example README:

```js
const fs = require('fs')
const examples = fs.readdirSync('./examples')

for (let example of examples) {
    const filename = `./examples/${example}/README.md`
    const markdown = fs.readFileSync(filename, 'utf8')
    const regex = new RegExp(`^yarn create next-app --example (.*)$`, 'gm')
    const output = markdown.replace(regex, (yarn, group) => {
        const pnpm = `pnpm create next-app -- --example ${group}`
        return `${yarn}\n# or\n${pnpm}`
    })
    fs.writeFileSync(filename, output)
}
```
2022-03-30 21:03:21 +00:00
VFLC
ced2040661
docs: fix typo in Script Component docs (#35731)
Added missing closing double quote : `strategy="worker` -> `strategy="worker"`



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-03-30 13:42:36 +00:00
Luis Alvarez D
ab119bcc79
Update middleware examples list (#35622)
Logging and analytics are not provided in vercel/examples using middleware.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-03-28 16:05:58 +00:00
TianenPang
0d401ddcb5
Fix typo in rewrites docs (#35639)
Correct the type of `trailingSlash` in config example

Modified: `docs/api-reference/next.config.js/rewrites.md`

```diff
- trailingSlash: 'true',
+ trailingSlash: true,
```
2022-03-27 18:15:08 +00:00
Jiachi Liu
27d23f5b7b
docs: update styling support for streaming (#35375)
## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-03-26 20:19:21 +00:00
Jiachi Liu
d5e122594d
Update rsc refresh typing and doc example (#35543)
* Update rsc refresh typing and doc example

* Update docs/api-reference/next/streaming.md

Co-authored-by: Shu Ding <g@shud.in>

Co-authored-by: Shu Ding <g@shud.in>
2022-03-25 22:54:07 +01:00
hiro
f16ee05f59
Fix typo in docs (#35561)
The following files have been modified.

- `docs/api-reference/next.config.js/rewrites.md`
- `docs/basic-features/script.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-03-24 01:02:40 +00:00
JJ Kasper
432261a1e1
Add link for revalidate from notFound section (#35553) 2022-03-23 13:43:12 -05:00
Heyang Zhou
860c97ccf5
SWC import modularization plugin (#34969) 2022-03-22 14:20:57 +01:00
Luka Hartwig
af95b0cb8d
Server component docs use wrong next version (#35313)
The docs for the react server components preview refer refer to `next@latest` which doesn't work. The linked demo uses `canary` so I replaced it in the install command.
2022-03-21 23:54:43 +00:00
Thiago M
cd47984152
clarify use of Script (#35491)
Leave more clear that <Script> component can't be used inside Head. Current it says "without need", which don't implies it can't be used.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-03-21 17:06:04 +00:00
Nelo
40a5c94ca7
Fix typo in getServerSideProps doc page (#35467)
While reading the documentation, I noticed that this paragraph was not correctly written and was hard to read. I fixed it adding a dot.

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-03-21 14:24:19 +00:00
Rich Haines
6f24c200db
Added note about why Next.js used 307 and 308 status codes (#35325)
This PR looks to clear up some confusion users are having around our decision to use 307 and 308 redirects, instead of 301 and 302

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-03-19 16:49:24 +00:00
Steven
bc460229ab
Update next/image docs for width & height (#35188)
- Fixes #30219 

Co-authored-by: Rich Haines <hello@richardhaines.dev>
2022-03-17 15:16:15 -04:00
Lee Robinson
43941d2475
[docs] Update going to production docs around caching headers (#35374)
Follow up on https://github.com/vercel/next.js/pull/35336 based on suggestions I would have made pre-merge.
2022-03-16 22:11:06 +00:00
Antonio Young
86c1bf6d2b
[docs] Update docs about Cache-Control default headers. (#35336)
* Update docs about Cache-Control default headers.

* Update docs: Override the default in case of gSSP

* Apply suggestions from code review

* Update going-to-production.md

Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-03-16 11:48:45 +01:00
Kyle Holmberg
ed1eedaa97
Encourage installation of sass as a devDep (#35323) 2022-03-15 15:42:36 +01:00
Aman Mittal
7891645d4b
Add info on context.ctx argument (#35303) 2022-03-15 15:34:49 +01:00
LongYinan
2e16d02faa
SWC emotion transform plugin (#34687) 2022-03-15 08:51:15 +01:00
Alex Castle
76bad07bdf
Add new 'raw' image layout (#34339)
This PR adds a new layout mode for images called `raw`, as discussed with the core team a while back. This mode has the following characteristics:
 - No wrapper `span` around the `img` element
 - No sizer svg
 - Almost no styles automatically added to the `img` element
 - `style` parameter is allowed and is passed through to the underlying `img` element

This also adds documentation changes to describe the new component.

There are a few tradeoffs and DX decisions that may warrant discussion/revision before merging. I'll add a few comments to highlight those issues.

- Related to #18637
2022-03-14 10:25:23 -04:00