()
| 100 | // It would be more correct to set contents=undefined here to get a loading state, |
| 101 | // but this produces an unnecessary flash for rapid transitions. |
| 102 | const getDiff = async () => { |
| 103 | const response = await fetch(`/diff/${filePair.idx}`, { |
| 104 | method: 'POST', |
| 105 | headers: { |
| 106 | Accept: 'application/json', |
| 107 | 'Content-Type': 'application/json', |
| 108 | }, |
| 109 | body: JSON.stringify({ |
| 110 | options: gitDiffOptionsToFlags(diffOptions), |
| 111 | normalize_json: normalizeJSON, |
| 112 | }), |
| 113 | }); |
| 114 | return response.json() as Promise<DiffRange[]>; |
| 115 | }; |
| 116 | |
| 117 | const {a, b} = filePair; |
| 118 | // Do XHRs for the contents of both sides in parallel and fill in the diff. |
no test coverage detected