[VS Code] Status Bar Icon update silently failing
Checklist
-
I'm using the latest version of the extension (see the latest version in the right column of this page) - Extension version: Put your extension version here
-
I'm using the latest VS Code version (find the latest version here) - VS Code version: Put your VS Code version here
-
I'm using a supported version of GitLab (see README for the supported version) - GitLab version: Put your GitLab version here, or say "happens on
gitlab.com"
- GitLab version: Put your GitLab version here, or say "happens on
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
TypeErrorlogging on the OUTPUT panel
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;
