Skip to content

Update browser extension icon with alert state

Warren Gifford requested to merge marek/browser-action-state into main

Created by: marekweb

Summary

This PR adds a mechanism for the browser extension's icon to get updated based on the state of the extension.

Implementation

The idea behind this implementation is to have an observable that emits when the browser extension state changes between active, inactive, and active-with-alert. Then we subscribe to it to update the browse action icon.

This includes the change to the enabled/disabled state of the extension, and also changes to the validation state of the Sourcegraph URL, to show an alert if the instance is no longer valid (basically when the user is no longer logged into the instance or if the instance stops existing).

Limitations

The implementation doesn't include the changing of the icon based on the currently open tab. A problem I faced is that we would need to track the per-tab state of the icon and I haven't come up with an elegant solution for that. We would need to track which tabs are overriding the icon with an alert. That's because when we override a tab's icon, that icon is permanently set for the lifetime of the page even if the global state changes.

Related

Closes #14203 (closed)

Merge request reports

Loading