Pipeline Graph: Fix query length bug
What does this MR do?
This is a medium-term fix for the problem outlined in #329895 (closed). In short, we use eTag caching for the pipeline graph, which means we have to use GET requests, which means the whole query goes into the URL. Apollo Client pretty-prints the queries that go into the URL and adds a bunch of whitespace, which we can’t control. It’s fine on our SaaS stack, but some self-hosted clients have a layer in the stack that rejects the length.
Although we looked into breaking up the queries, the minimal query is still too long — anything shorter and we’d be polling only segments, which could lead to weird inconsistency problems. We can’t delete the old graph till this is fixed.
And so, here we use a custom fetch
function when the Apollo Link uses GET
. (We already have to use a different link library.) This function removes all instances of multiple spaces and newlines in the query parameter, taking a test query from over 4000 characters to ~1400. Queries under 2000 characters are considered "safe".
While this is a less-than-ideal solution, it will unblock progress until subscriptions are ready (#332485) or another more-robust solution, such as query compression are implemented. (Continuing discussion will take place or be linked in #329895 (closed).) But we will be able to address the bug in %14.1!
Screenshots or Screencasts (strongly suggested)
before | after |
---|---|
Does this MR meet the acceptance criteria?
Conformity
-
I have included changelog trailers, or none are needed. (Does this MR need a changelog?) -
I have self-reviewed this MR per code review guidelines. -
I have followed the style guides. -
This change is backwards compatible across updates, or this does not apply.
Availability and Testing
-
I have added/updated tests following the Testing Guide, or it's not needed. (Consider all test levels. See the Test Planning Process.) -
I have tested this MR in all supported browsers, or it's not needed.
Related to #329895 (closed)