GithubHelp home page GithubHelp logo

Comments (4)

akomm avatar akomm commented on May 28, 2024 1

Since the XHR info is broken anyway, removing the .load call in graphQLFetcher actually improves the situation. At least you can close the toolbar and you can see the XHR request history this way.

There is sadly no API from Sfjs side to reload it (or I missed it somewhere) and the initializer is an IIFE. One possible way to fix it I see is store the template in a JS (twig include) variable as string with token and evtl. nounce placeholder to replace and inject new script tags with the IIEF string content... Not sure how to get to the correct nounce value at this moment though.

Workaround to make variables in graphiql accessible and XHR info more useable until fix:

# app/config/config_dev.yml
parameters:
  overblog_graphql.graphiql_template: 'graphiql.html.twig'
{# app/Resources/views/graphiql.html.twig #}
{% extends 'OverblogGraphQLBundle:GraphiQL:index.html.twig' %}

{% block body_script %}
  <script>
    var endpoint = {{ endpoint | json_encode | raw }}

      function graphQLFetcher(params) {
        var headers

          {% block graphql_fetcher_headers %}
        headers = {
          "Accept": "application/json",
          "Content-Type": "application/json",
        }
          {% endblock graphql_fetcher_headers %}

        return fetch(endpoint, {
          method: "post",
          headers: headers,
          body: JSON.stringify(params),
          credentials: 'include',
        }).then((res) => {
          return res.text()
        }).then((body) => {
          try {
            return JSON.parse(body)
          } catch (err) {
            return body
          }
        })
      }

    ReactDOM.render(
      React.createElement(GraphiQL, {
        fetcher: graphQLFetcher
      }),
      document.body
    )
  </script>
{% endblock body_script %}

from graphqlbundle.

mcg-web avatar mcg-web commented on May 28, 2024 1

The best solution is to remove the reload, i think right now.

from graphqlbundle.

mcg-web avatar mcg-web commented on May 28, 2024 1

Removed in 0.8.2. I also added a twig block to leave possibility to implement this in overridden template. Thanks again for reporting.

from graphqlbundle.

mcg-web avatar mcg-web commented on May 28, 2024

Thanks for bringing up this bug.

from graphqlbundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.