Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop the dashboard UI from stutter by checking the build sha #2953

Merged
merged 1 commit into from
Feb 17, 2022

Conversation

tpmai22
Copy link
Contributor

@tpmai22 tpmai22 commented Feb 16, 2022

Issue This PR Addresses

Fix #2773

Type of Change

  • Bugfix: Change which fixes an issue
  • New Feature: Change which adds functionality
  • Documentation Update: Change which improves documentation
  • UI: Change which improves UI

Description

Checking the sha of the build and stop re-rendering if we have the same sha displayed in the build log and the build header already

Steps to test the PR

Checklist

  • Quality: This PR builds and passes our npm test and works locally
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Screenshots: This PR includes screenshots or GIFs of the changes made or an explanation of why it does not (if applicable)
  • Documentation: This PR includes updated/added documentation to user exposed functionality or configuration variables are added/changed or an explanation of why it does not(if applicable)

@gitpod-io
Copy link

gitpod-io bot commented Feb 16, 2022

@tpmai22 tpmai22 self-assigned this Feb 16, 2022
@tpmai22 tpmai22 added this to the 2.7 Release milestone Feb 16, 2022
@@ -3,5 +3,5 @@ import './main.js';

window.addEventListener('load', () => {
checkForBuild();
setInterval(checkForBuild, 5000);
setInterval(checkForBuild, 30000);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can probably be every 10s, since you'll ignore it if the build hasn't changed.

humphd
humphd previously approved these changes Feb 16, 2022
TueeNguyen
TueeNguyen previously approved these changes Feb 16, 2022
@@ -3,11 +3,19 @@ import terminal from './terminal.js';
import buildHeader from './build-header.js';
import showToast from '../utils/toast.js';

let build;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we put this variable inside the function checkBuildStatus()?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting it here is ok, we want to have a variable here containing the build being shown in the build logs. This is compared against upcoming builds, if the same, skip writing a new log to the terminal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean the best practice is to avoid global variable @humphd can I have your thought on this ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a module-level variable vs. global, so it's not terrible. If it really bothered you, you could wrap this data + your function below in a class, so they go together. But this is no worse than showToast, which is also being defined at the module level.

In general I agree with you: fewer variables, reduce their scope. But this is hard to avoid completely.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood !

DukeManh
DukeManh previously approved these changes Feb 17, 2022
@@ -3,11 +3,19 @@ import terminal from './terminal.js';
import buildHeader from './build-header.js';
import showToast from '../utils/toast.js';

let build;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting it here is ok, we want to have a variable here containing the build being shown in the build logs. This is compared against upcoming builds, if the same, skip writing a new log to the terminal.

@TueeNguyen TueeNguyen dismissed stale reviews from DukeManh, humphd, and themself via e938990 February 17, 2022 02:21
@TueeNguyen TueeNguyen merged commit f8964f1 into master Feb 17, 2022
@TueeNguyen TueeNguyen deleted the issue-2773 branch February 17, 2022 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dashboard build log updates previous build log too often
6 participants