rsnext/packages/next/server
Kara 9be387c7f4
getServerSideProps should support props value as Promise (#28607)
Previous to this change, getServerSideProps could only return plain objects
for props, e.g.:

```javascript
export async function getServerSideProps() {
  return {
    props: {
      text: 'some value',
    }
  }
}
```

With this commit, the props object can also be a Promise, e.g.

```javascript
export async function getServerSideProps() {
  return {
    props: (async function () {
      return {
        text: 'promise value',
      }
    })(),
  }
}
```

For now, the framework simply waits for the results of the props Promise to resolve,
but this small change sets the groundwork for later allowing props to be streamed (cc @devknoll).

## Feature

- [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. -- *This is part of @devknoll's ongoing work to support streaming.*
- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not. *not sure if this applies here*
- [ ] Errors have helpful link attached, see `contributing.md`
2021-08-30 19:52:15 +00:00
..
dev Ensure dev server side errors are correct (#28520) 2021-08-27 14:29:30 +02:00
lib Update to latest babel versions (#28174) 2021-08-17 09:18:08 +02:00
api-utils.ts Ensure dev server side errors are correct (#28520) 2021-08-27 14:29:30 +02:00
config-shared.ts Add missing typescript property to NextConfig (#28459) 2021-08-24 14:08:18 +00:00
config-utils-worker.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
config-utils.ts Fix forked NODE_OPTIONS except for inspect (#28420) 2021-08-23 12:14:17 -05:00
config.ts Update i18n locales limit to warning (#28429) 2021-08-25 08:54:38 -05:00
crypto-utils.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
denormalize-page-path.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
font-utils.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
get-page-files.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
get-route-from-entrypoint.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
htmlescape.ts Upgrade to Prettier 2 (#13061) 2020-05-18 15:24:37 -04:00
image-config.ts Add minimumCacheTTL config for Image Optimization (#27200) 2021-07-15 19:55:12 +00:00
image-optimizer.ts Add CSP to Image Optimization API (#28620) 2021-08-30 16:51:47 +00:00
incremental-cache.ts Fix revalidate for initial notFound: true paths (#28097) 2021-08-14 13:11:40 +00:00
load-components.ts Update to latest babel versions (#28174) 2021-08-17 09:18:08 +02:00
next-server.ts Ensure dev server side errors are correct (#28520) 2021-08-27 14:29:30 +02:00
next.ts Use SWC to compile Next.js core server files (#27167) 2021-07-14 18:12:04 +00:00
node-polyfill-fetch.js Add next.config.js option to override default keepAlive (#27709) 2021-08-03 00:38:42 +00:00
normalize-page-path.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
optimize-amp.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
render.tsx getServerSideProps should support props value as Promise (#28607) 2021-08-30 19:52:15 +00:00
require.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
response-cache.ts Use zen-observable library (#28214) 2021-08-18 03:29:43 +00:00
router.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
send-payload.ts Use zen-observable library (#28214) 2021-08-18 03:29:43 +00:00
serve-static.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
utils.ts Use zen-observable library (#28214) 2021-08-18 03:29:43 +00:00