Skip to content
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

Incorrect template rendering when overriding graphql IDE template #3276

Open
msopacua opened this issue Dec 5, 2023 · 2 comments
Open

Incorrect template rendering when overriding graphql IDE template #3276

msopacua opened this issue Dec 5, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@msopacua
Copy link

msopacua commented Dec 5, 2023

The GraphQLView and its async version allow overriding the template file. However, the loading of the template is incorrect, resulting in JSON.parse("") // empty string , because the variable is already replaced.

Additional Context

In the view we see the following code:

        try:
            template = Template(render_to_string("graphql/graphiql.html"))
        except TemplateDoesNotExist:
            template = Template(self.graphql_ide_html)

The loading in the try section, erronously calls render_to_string and sticks the result into a Template class. However, render_to_string already renders the entire template, replacing its variables.

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@msopacua msopacua added the bug Something isn't working label Dec 5, 2023
@patrick91
Copy link
Member

@msopacua would you be interested in sending a PR to fix this?

@msopacua
Copy link
Author

msopacua commented Dec 6, 2023

Yes, will do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants