Skip to content

Commit

Permalink
Stop the dashboard UI from stutter by checking the build sha
Browse files Browse the repository at this point in the history
  • Loading branch information
tpmai22 committed Feb 16, 2022
1 parent 1d64595 commit 6f8e5c1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/api/status/public/js/build-log/check-for-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@ import terminal from './terminal.js';
import buildHeader from './build-header.js';
import showToast from '../utils/toast.js';

let build;

export default async function checkForBuild() {
const status = await checkBuildStatus();

// Prefer the current build, but fallback to the previous one
const build = status.current ?? status.previous;
const buildData = status.current ?? status.previous;

if (build && build.sha === buildData.sha) {
return;
}

build = buildData;

// Render the build header info
buildHeader(build);
Expand Down
2 changes: 1 addition & 1 deletion src/api/status/public/js/pages/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import './main.js';

window.addEventListener('load', () => {
checkForBuild();
setInterval(checkForBuild, 5000);
setInterval(checkForBuild, 10000);
});

0 comments on commit 6f8e5c1

Please sign in to comment.