Skip to content

Commit

Permalink
Fix stale tab markers on startup with the browser setting "Continue w…
Browse files Browse the repository at this point in the history
…here you left off"
  • Loading branch information
david-tejada committed Jul 7, 2023
1 parent 71eef05 commit bec4da4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/background/misc/tabMarkers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,19 @@ export async function resetTabMarkers() {

return tabMarkers;
});

// We need to reload all "unloaded" tabs in case the user has the setting
// "Continue where you left off" enabled. If we don't those tabs will have an
// invalid tab marker. We can also not reassign the tab markers to those
// "unloaded" tabs since we can't get their title, so we don't know which tab
// marker each one has.
if (!(await retrieve("includeTabMarkers"))) return;

const tabs = await browser.tabs.query({});

await Promise.all(
tabs
.filter((tab) => tab.status === "unloaded")
.map(async (tab) => browser.tabs.reload(tab.id))
);
}

0 comments on commit bec4da4

Please sign in to comment.