Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polish: Make The Popup Follow the Active Tab Context #33

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/ui/browserAction/popupPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,16 @@ export class BrowserActionPopup extends LitElement {
super();
this.pageURL = null;
this._siteContext = null;
this.updatePage();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we call updatePage() after subscribing to the controller state?

browser.tabs.onUpdated.addListener(() => this.updatePage());
browser.tabs.onActivated.addListener(() => this.updatePage());
vpnController.state.subscribe((s) => (this.vpnState = s));
}
updatePage() {
Utils.getCurrentTab().then(async (tab) => {
if (!Utils.isValidForProxySetting(tab.url)) {
this.pageURL = null;
this._siteContext = null;
return;
}
const hostname = Utils.getFormattedHostname(tab.url);
Expand All @@ -61,8 +69,8 @@ export class BrowserActionPopup extends LitElement {
this._siteContext = proxyHandler.siteContexts.value.get(this.pageURL);
}
});
vpnController.state.subscribe((s) => (this.vpnState = s));
}

connectedCallback() {
super.connectedCallback();
}
Expand Down