[VS Code] Status Bar Icon update silently failing

Checklist

Summary

As result of !1872 (merged), regression bug was introduced.

Steps to reproduce

  • Run vs code extension locally

  • Open OUTPUT panel and select Extension Host

  • Trigger code suggestion

  • Check TypeError logging on the OUTPUT panel

    image.png

What is the current bug behavior?

When code suggestion state is loading or error, status bar item update throws a TypeError.

Change hasn't been released and in terms of user experience, no visible issue as status bar item is no longer supposed to change its icon with loading and error states.

What is the expected correct behavior?

When code suggestion state is loading or error, updateCodeSuggestionsItem shouldn't try to update the UI.

Relevant logs and/or screenshots

024-08-27 14:33:17.875 [error] TypeError: Cannot read properties of undefined (reading 'iconName')
    at CodeSuggestionsStatusBarItem.updateCodeSuggestionsItem (/Users/jlee/dev/gitlab-vscode-extension/src/common/code_suggestions/code_suggestions_status_bar_item.ts:59:62)

Possible fixes

In code_suggestions_status_bar_item.ts, add check for loading and error state to end the function execution right away.

if (state === VisibleCodeSuggestionsState.LOADING || state === VisibleCodeSuggestionsState.ERROR) return;

Edited by Juhee Lee