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 }) => { ...@@ -319,16 +319,19 @@ export const startRenderDiffsQueue = ({ state, commit }) => {
const nextFile = diffFilesToRender[currentDiffFileIndex]; const nextFile = diffFilesToRender[currentDiffFileIndex];
if (nextFile) { if (nextFile) {
let retryCount = 0;
currentDiffFileIndex += 1; currentDiffFileIndex += 1;
commit(types.RENDER_FILE, nextFile); commit(types.RENDER_FILE, nextFile);
const requestIdle = () => const requestIdle = () =>
requestIdleCallback((idleDeadline) => { requestIdleCallback((idleDeadline) => {
// Wait for at least 5ms before trying to render // 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(); checkItem();
} else { } else {
requestIdle(); 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