[VS Code] Bug: 'authentication-required' state causing status bar icon error
Problem to solve
When debugging VSCode and opening the "Webview Developer Tools" there is a consistent error logged to the devtools console:
TypeError: Cannot read properties of undefined (reading 'iconName')
at CodeSuggestionsStatusBarItem.updateCodeSuggestionsItem (/home/elwyn/repos/editor-extensions/vscode-extension/src/common/code_suggestions/code_suggestions_status_bar_item.ts:69:62)
It seems we sometimes get an undefined value for newUiState:
const newUiState = CODE_SUGGESTIONS_STATUSES[state];
This is due to the state value being passed to updateCodeSuggestionsItem being 'authentication-required', which is not one of the options on the CODE_SUGGESTIONS_STATUSES record.
This means the status bar icon will not correctly display. Once a new state is passed, the status bar icon is correctly updated.
Proposed solution
Handle the authentication-required state so the correct icon is initially displayed
Edited by Elwyn Benson