Commit bf44f562 authored by Phil Hughes's avatar Phil Hughes

Fixes a bug where sometimes diff files would not render

Closes https://gitlab.com/gitlab-org/gitlab/-/issues/327728
parent 69d3c36c
......@@ -319,16 +319,19 @@ export const startRenderDiffsQueue = ({ state, commit }) => {
const nextFile = diffFilesToRender[currentDiffFileIndex];
if (nextFile) {
let retryCount = 0;
currentDiffFileIndex += 1;
commit(types.RENDER_FILE, nextFile);
const requestIdle = () =>
requestIdleCallback((idleDeadline) => {
// Wait for at least 5ms before trying to render
if (idleDeadline.timeRemaining() >= 6) {
// or for 5 tries and then force render the file
if (idleDeadline.timeRemaining() >= 5 || retryCount > 4) {
checkItem();
} else {
requestIdle();
retryCount += 1;
}
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment