Graphiql: Non-breaking spaces break the explorer

Created on 28 Oct 2017  路  5Comments  路  Source: graphql/graphiql

If you paste code that includes non-breaking spaces, the explorer stops responding -- the pasted text doesn't appear, queries can't be run, the doc explorer doesn't load. And, you're no longer able to enter any new queries, regardless of whether you paste them or type them. Clearing cache and cookies did not fix the problem, nor did clearing local storage.

The explorer worked again after I created a new Chrome profile.

bug help wanted

Most helpful comment

Has there been any progress made on this?

All 5 comments

I'm having the exact same problem right now, thank you for the fix.

The Internet explorer?

The GraphiQL explorer -- the query editor, the response pane, the documentation explorer. The same thing happened in both IE 11 and Chrome. I didn't try other browsers.

@sereanaseim @joenot443 @syzer This is most likely due to the CodeMirror (or codemirror-graphql online parser) not able to recognize the nbsp and advance the mode stream. Clearing the cache/local storage and restarting the node server (if you were using the example app) should have mitigated this issue, so it's surprising that it hadn't for you.

The fix should be as easy as including &nbsp as one of the whitespace characters in the parser, but that's difficult since there are many representations for a nbsp, all depending on the keyboard layout/browsers. I think a better fix would be to reset GraphiQL to the "default" state when a mode fails to advance in any of our CodeMirror-related instances.

I'll put this up for grabs if anyone wants to tackle it. Also please let us know if you have a better idea!

Has there been any progress made on this?

Was this page helpful?
0 / 5 - 0 ratings