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
NEBULA-1385: Add initialState to embedable sandbox based on config #6628
Changes from 2 commits
e347e53
0df5c73
c3d22e4
60ebbc3
62019bc
719587c
6a7d5a0
30ed632
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we still want to add this? This API applies to both sandbox and explorer, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the local dev docs, so they will only ever lead to sandbox afaict There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no strong opinion tho! |
||||||
|
||||||
If you omit this, the Explorer initially loads an example query based on your schema. | ||||||
|
||||||
</td> | ||||||
</tr> | ||||||
|
||||||
<tr> | ||||||
<td> | ||||||
|
||||||
###### `variables` | ||||||
|
||||||
`Record<string, string>` | ||||||
</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` | ||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -142,6 +142,7 @@ id="embeddableSandbox" | |||||||||||||
target: '#embeddableSandbox', | ||||||||||||||
initialEndpoint, | ||||||||||||||
includeCookies: ${config.includeCookies ?? 'false'}, | ||||||||||||||
initialState: ${config}, | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @William010x and I identified that you can't just drop an object into a string template like this (you get an Additionally, I'll mention that the type of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the substitutions in the template string (
I tested this HTML string with the Embedded Sandbox and it seems to work without needing to Alternatively, doing something like these (similar to the embeddedExplorerHTML) also works
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll look into adding proper unit tests for this though! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Neat, yeah if it's not adding quotes like I expected then you should be all set! |
||||||||||||||
}); | ||||||||||||||
</script> | ||||||||||||||
`; | ||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do these get passed through to sandbox in the regular landing page? We were just missing them before but they are supported right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup! they were always in
ApolloServerPluginLandingPageDefaultBaseOptions
, but just not mentioned in the docs