console: Fix the broken GraphiQL REST button (close #9189)

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6779
GitOrigin-RevId: 94db764b17e5c7700a1ec501b5f6d4417f3af4f0
This commit is contained in:
Stefano Magni 2022-11-08 16:02:55 +01:00 committed by hasura-bot
parent b3f783d1b8
commit 90f6cde701
2 changed files with 8 additions and 2 deletions

View File

@ -31,6 +31,10 @@ describe('Tracing GraphiQL plugins usage', () => {
});
it('When the users interact with GraphiQL, then some custom Heap events must be traced', () => {
// ATTENTION: This test checks only that the events are sent, not that the involved features work!
// For example: the query used in this test is not valid, but the test passes anyway since it
// checks for the events only
// --------------------
cy.log('**--- Click the GraphiQL Prettify button**');
cy.get('.graphiql-container').within(() => {

View File

@ -171,7 +171,7 @@ class GraphiQLWrapper extends Component {
dispatch(_push(getActionsCreateRoute()));
};
const routeToREST = gqlProps => () => {
const createRouteToREST = gqlProps => () => {
const { query, schema } = graphiqlContext.state;
setLSItem(LS_KEYS.graphiqlQuery, query);
if (!query || !schema || !gqlProps.query || !isQueryValid(query)) {
@ -239,6 +239,8 @@ class GraphiQLWrapper extends Component {
// get toolbar buttons
const getGraphiqlButtons = () => {
const routeToREST = createRouteToREST(graphiqlProps);
const buttons = [
{
label: 'Prettify',
@ -274,7 +276,7 @@ class GraphiQLWrapper extends Component {
title: 'REST Endpoints',
onClick: () => {
trackGraphiQlToolbarButtonClick('REST');
routeToREST(graphiqlProps);
routeToREST();
},
},
];