Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getServerSideProps should support props value as Promise #28607

Merged
merged 3 commits into from Aug 30, 2021

Commits on Aug 30, 2021

  1. getServerSideProps should support props value as Promise

    Previous to this change, getServerSideProps could only return plain objects
    for props, e.g.:
    
    ```
    export async function getServerSideProps() {
      return {
        props: {
          text: 'some value',
        }
      }
    }
    ```
    
    With this commit, the props object can also be a Promise, e.g.
    
    ```
    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.
    kara committed Aug 30, 2021
    Copy the full SHA
    b5366b9 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    c9f29d7 View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    376a2f4 View commit details
    Browse the repository at this point in the history