Commit 898bc640 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'ph/327728/fixDiffFilesNotAlwaysRendering' into 'master'

Fixes a bug where sometimes diff files would not render

See merge request gitlab-org/gitlab!59451
parents b61d14e9 bf44f562
......@@ -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