Skip to content

Commit d83b57a

Browse files
committed
Run the fresh query (same as in docs)
1 parent af69f2f commit d83b57a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/components/index-page/how-it-works/interactive-editor.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,16 @@ export default function InteractiveEditor() {
2222
const [variables, setVariables] = useState("")
2323
const editorQueryId = React.useRef(0)
2424

25-
async function runQuery(options: { manual: boolean }) {
25+
async function runQuery(
26+
options: { manual: boolean },
27+
source: string = query,
28+
) {
2629
editorQueryId.current++
2730
const queryID = editorQueryId.current
2831
try {
2932
const result = await graphql({
3033
schema,
31-
source: query,
34+
source,
3235
variableValues: JSON.parse(variables || "{}"),
3336
})
3437

@@ -66,7 +69,7 @@ export default function InteractiveEditor() {
6669
schema={schema}
6770
onEdit={newQuery => {
6871
setQuery(newQuery)
69-
runQuery({ manual: false })
72+
runQuery({ manual: false }, newQuery)
7073
}}
7174
runQuery={() => {
7275
setVariableTypes(getVariableToType(schema, query))
@@ -110,7 +113,7 @@ export default function InteractiveEditor() {
110113
/>
111114
<HowItWorksListItem
112115
text="Get predictable results"
113-
code={<ResultViewer value={results} />}
116+
code={<ResultViewer value={results} vainlyExtractData />}
114117
/>
115118
</>
116119
)

0 commit comments

Comments
 (0)