Skip to content

perf(webview): use GraphQL to load MR/Issue discussions

Tomas Vik requested to merge 253-use-graphql-for-discussions into main

This MR changes the implementation of loading discussions into our webview. This drastically reduces the number of requests that the client has to perform.

It's critical to review the commits in this MR separately. That will greatly reduce the cognitive load. The MR looks large but most of the changes are fixtures, snapshots and package-lock.json.

I started refactoring (!143 (closed)) as preparation for #257 (closed). Then the refactoring got too large for one review and I had to split it in two MRs. This is the first MR.

Why does this reduce the number of requests?

The original REST response didn't contain the HTML body of the note. That means we only get the plain text response:

@viktomas, done! :smile: It was surprisingly easy to replace it too.

instead of the HTML

<p data-sourcepos=\"1:1-1:68\" dir=\"auto\"><a href=\"/viktomas\" data-user=\"3457201\" data-reference-type=\"user\" data-container=\"body\" data-placement=\"top\" class=\"gfm gfm-project_member js-user-link\" title=\"Tomas Vik\">@viktomas</a>, done! <gl-emoji title=\"smiling face with open mouth and smiling eyes\" data-name=\"smile\" data-unicode-version=\"6.0\">😄</gl-emoji> It was surprisingly easy to replace it too.</p>

And so the current implementation makes an additional request for every single note.

For !40 (closed) the difference is:

before after
mitmproxy mitmproxy

The outstanding /markdown requests are system notes and label events. Those calls are going to be eliminated in the next MR (already fixed in the !143 (closed) that I'm breaking down).

Edited by Tomas Vik

Merge request reports