Skip to content

feat: refresh MR only if it the refresh is user initiated

Tomas Vik requested to merge 60-refresh-sidebar-and-status-bar-3 into main

This has two changes to the way we refresh current branch information in the status bar and the tree view. The following screenshot is for illustration of where the change has been made but there is no UI change, only the logic behind refreshing.

image

Controlling when we refresh the MR item

This MR introduces logic that differentiates between user-initiated refresh (user clicked on a refresh button) and automatic refresh (happens every 30s). Recreating the MR item in the tree view is a destructive operation and can lead to the unsubmitted MR comments being lost. This is current behaviour, but the automatic refreshing of the sidebar might mean that the user writes a message and automatic refresh is going to delete it.

We only recreate the MR item if the user clicked the refresh button or changed the branch.

Fetching jobs only once

There has been one additional change in this MR: We extract the logic that fetches CI jobs for the latest pipeline. Instead of fetching the jobs twice (once in the status bar and once in the tree view), we fetch them only once in the refresher.


It might be best to review this MR commit-by-commit, even though there is some rework (introducing code that will in the next commit) between commits

Related to #60 (closed)

Edited by Tomas Vik

Merge request reports