Skip to content

Commit a13a4f8

Browse files
committed
fix: enable toolbar action after URL parsing
The action is enabled only after `parseUrl` returns a good `urlInfo`, removing the badge flicker on non-file forge pages.
1 parent e13cd1f commit a13a4f8

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎background.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,15 @@ async function main(tab) {
176176
return
177177
}
178178

179-
browser.action.enable(tab.id)
180-
181-
// get project info from the URL (forge-specific parsing)
179+
// get project info from the URL (forge-specific parsing); enable the
180+
// action only once the URL is known good, so the badge never flickers
181+
// on non-file pages (disable covers a file -> non-file navigation)
182182
const urlInfo = forge.parseUrl(url)
183183
if (urlInfo == null) {
184184
browser.action.disable(tab.id)
185185
return
186186
}
187+
browser.action.enable(tab.id)
187188

188189
// drop the result of the tab's previous page: the popup shows its loading
189190
// state until this page's result lands

0 commit comments

Comments
 (0)