Skip to content

Commit

Permalink
NEBULA-1385: Add initialState to embeddable sandbox based on config (
Browse files Browse the repository at this point in the history
…#6628)

Allow configuration of embeddable sandbox initial state. The initial `document`,
`variables`, and `headers` can now be provided to the plugin config to populate
these values on page load.
  • Loading branch information
William010x committed Jul 5, 2022
1 parent b1ddbf0 commit 07639bb
Show file tree
Hide file tree
Showing 10 changed files with 407 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -10,7 +10,7 @@ The version headers in this history reflect the versions of Apollo Server itself

## vNEXT

- Nothing yet! Stay tuned.
- Add `document`, `variables`, `headers` as an option in the `ApolloServerPluginLandingPageLocalDefault` plugins. The embedded version of Apollo Sandbox can now use these options as an initial state. [PR #6628](https://github.com/apollographql/apollo-server/pull/6628)

## v3.9.0

Expand Down
48 changes: 47 additions & 1 deletion docs/source/api/plugin/landing-pages.md
Expand Up @@ -106,6 +106,52 @@ By default, the landing page displays a footer that links to the documentation t
<tr>
<td>

###### `document`

`string`
</td>
<td>

A GraphQL document (eg, query or mutation) to populate in the Studio Explorer's editor on load.

If you omit this, the Explorer initially loads an example query based on your schema.

</td>
</tr>

<tr>
<td>

###### `variables`

`Record<string, string | Record>`
</td>
<td>

An object containing initial variable values to populate in the Explorer on load.

If provided, these variables should apply to the initial query you provide in `document`.

</td>
</tr>

<tr>
<td>

###### `headers`

`Record<string, string>`
</td>
<td>

An object containing initial HTTP header values to populate in the Explorer on load.

</td>
</tr>

<tr>
<td>

###### `includeCookies`

`boolean`
Expand Down Expand Up @@ -228,7 +274,7 @@ If you omit this, the Explorer initially loads an example query based on your sc

###### `variables`

`Record<string, string>`
`Record<string, string | Record>`
</td>
<td>

Expand Down
182 changes: 182 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -108,6 +108,7 @@
"jest-config": "28.1.2",
"jest-junit": "14.0.0",
"jest-mock-random": "1.1.1",
"jest-serializer-html": "^7.1.0",
"js-sha256": "0.9.0",
"koa": "2.13.4",
"koa-router": "10.1.1",
Expand Down

0 comments on commit 07639bb

Please sign in to comment.