Fix GraphiQL IDE rendering (#137)#138
Fix GraphiQL IDE rendering (#137)#138leonardwellthy wants to merge 1 commit intographql-python:mainfrom
Conversation
leonardwellthy
commented
Feb 6, 2026
- Fix Flask views using Jinja2's render_template_string which HTML-escaped JSON values, breaking the GraphiQL JS config. Both sync and async views now use to_template_string() with the framework-agnostic simple_renderer.
- Fix operationName not passed to the template due to a variable naming mismatch (operationName vs operation_name) in the sync Flask view.
- Restore the locationQuery JS function accidentally removed in 578453f, which caused a ReferenceError when editing queries in the GraphiQL IDE.
- Escape < and > as \u003c and \u003e in tojson() to prevent queries containing </script> from breaking the page by prematurely closing the script tag.
- Add CodeMirror 5 fold gutter CSS to fix broken fold markers in the GraphiQL editor.
- Fix Flask views using Jinja2's render_template_string which HTML-escaped JSON values, breaking the GraphiQL JS config. Both sync and async views now use to_template_string() with the framework-agnostic simple_renderer. - Fix operationName not passed to the template due to a variable naming mismatch (operationName vs operation_name) in the sync Flask view. - Restore the locationQuery JS function accidentally removed in 578453f, which caused a ReferenceError when editing queries in the GraphiQL IDE. - Escape < and > as \u003c and \u003e in tojson() to prevent queries containing </script> from breaking the page by prematurely closing the script tag. - Add CodeMirror 5 fold gutter CSS to fix broken fold markers in the GraphiQL editor.
3388fc1 to
5cb34ef
Compare
|
Today, I've tried to upgrade to v3.0.0 and encountered some of these errors. I've been able to patch some of these internally (like injecting missing javascript,...) and make it work, but it's ugly and it would be way better to have this PR accepted and released. I'll look at it tomorrow Sadly I'm not maintainer here, but at least I can look at it and wish for accepting it. |
|
Maybe @KingDarBoja |
|
Or @syrusakbary (sorry for spamming) |
|
Sorry for the late response. I do not use graphql-python anymore nor I have the permissions to review this PR, plus the fact I can't remember how everything works (been years since last time I checked this repo), however, everything looks okay to me and the tests are passing. Hopefully the maintainer can take a look at it soon enough @syrusakbary |