Closed Elec0 closed 4 months ago
When there's tabs in a group and the window is being entirely closed, the tabs in groups are updated to remove them from said groups before the window is actually removed
.
This is causing a problem because I have it saving all the windows tabs when a tab updates.
15:27:17.420 popup.js:107 Popup: windowRemoved 1310792135
15:27:17.426 background.ts:90 Tab 1310792137 updated. Change info: {groupId: -1}
15:27:17.426 background.ts:91 Is window closing? []
15:27:17.428 background.ts:23 Window 1310792135 is a workspace, saving tabs...
15:27:17.428 background.ts:25 Will save tabs to sync storage here.
15:27:17.429 popup-message-helper.ts:54 getWorkspaces response {data: '{"workspaces":[["69111d75-656f-42cf-8dbc-abadf0b64…0792135,"ea4c4715-9d69-47cb-a628-9f2d2dc06534"]]}'}
15:27:17.430 workspace-entry-logic.ts:14 listWorkspaces WorkspaceStorage {workspaces: Map(3), windowIdToUuid: Map(3), Symbol(Symbol.toStringTag): 'WorkspaceStorage'}windowIdToUuid: Map(3) {1310791299 => '69111d75-656f-42cf-8dbc-abadf0b643d9', 1310791311 => '506cca07-16be-45e0-a930-4efe49235365', 1310792135 => 'ea4c4715-9d69-47cb-a628-9f2d2dc06534'}workspaces: Map(3)[[Entries]]0: {"69111d75-656f-42cf-8dbc-abadf0b643d9" => Workspace}1: {"506cca07-16be-45e0-a930-4efe49235365" => Workspace}2: {"ea4c4715-9d69-47cb-a628-9f2d2dc06534" => Workspace}key: "ea4c4715-9d69-47cb-a628-9f2d2dc06534"value: Workspacename: "Tab groups"tabGroups: Map(0) {size: 0}tabs: Map(2)[[Entries]]0: {1310792136 => TabStub}1: {1310792137 => TabStub}size: 2[[Prototype]]: Mapuuid: "ea4c4715-9d69-47cb-a628-9f2d2dc06534"windowId: 1310792135[[Prototype]]: Objectsize: 3[[Prototype]]: MapSymbol(Symbol.toStringTag): "WorkspaceStorage"size: (...)[[Prototype]]: Object
Popup knows the window is closing before anything else does. I suppose I could have it send a message to the background when a window is being removed, to notify it to ignore any updates to the tab group values.
Actually, I think the best solution for this is also to handle #11 at the same time: Ignore any update to the workspace storage where the window has no tabs attached to it. I can't think of a reason we would want to save an empty workspace. If, in the future, that is required for some reason, this problem will have to be revisited.
Tabs put into groups should be preserved and the groups should be re-created as they originally were.
Currently it appears no tabs are opened when a tab group exists.