Stop unstash from absorbing loose tabs into a group
With browser.tabs.insertAfterCurrent enabled, a tab created while a
grouped tab is active inherits that group. During unstash, loose tabs
restored after the last group folder were never regrouped, so they
stayed stuck in that group. Ungroup each loose tab after creating it.
Assisted-by: Claude Opus 4.8 (claude-opus-4-8)
diff --git a/.config/glide/glide.ts b/.config/glide/glide.ts
index b676a54d..e4d026f4 100644
--- a/.config/glide/glide.ts
+++ b/.config/glide/glide.ts
@@ -204,8 +204,11 @@ async function unstashTabs(stashId: string) {
for (const child of children) {
if (child.url) {
- // Top-level bookmark (ungrouped tab)
- await browser.tabs.create({ url: child.url });
+ // Top-level bookmark (ungrouped tab). With browser.tabs.insertAfterCurrent
+ // enabled, a tab created while a grouped tab is active is added to that
+ // group, so ungroup it to keep loose tabs loose.
+ const tab = await browser.tabs.create({ url: child.url });
+ if (tab.id) await browser.tabs.ungroup(tab.id);
} else {
// Folder = tab group
const groupBookmarks = await browser.bookmarks.getChildren(child.id);