diff --git a/app/lib/features/geckoview/domain/repositories/tab.dart b/app/lib/features/geckoview/domain/repositories/tab.dart index c010eb08..879abf17 100644 --- a/app/lib/features/geckoview/domain/repositories/tab.dart +++ b/app/lib/features/geckoview/domain/repositories/tab.dart @@ -455,11 +455,19 @@ class TabRepository extends _$TabRepository { tabState.historyState.items.isEmpty; if (event.blocked || tabIsEmpty) { + // Check if contextual identity is changing + final currentContainerData = await ref + .read(tabDataRepositoryProvider.notifier) + .getTabContainerData(tabState.id); + + final contextChanging = containerData.metadata.contextualIdentity != + currentContainerData?.metadata.contextualIdentity; + await addTab( url: uri, private: tabState.isPrivate, container: Value(containerData), - parentId: tabState.id, + parentId: contextChanging ? null : tabState.id, // Break parent chain if context changes selectTab: true, ); diff --git a/app/lib/features/geckoview/domain/repositories/tab.g.dart b/app/lib/features/geckoview/domain/repositories/tab.g.dart index f29fb0a8..872fd081 100644 --- a/app/lib/features/geckoview/domain/repositories/tab.g.dart +++ b/app/lib/features/geckoview/domain/repositories/tab.g.dart @@ -41,7 +41,7 @@ final class TabRepositoryProvider } } -String _$tabRepositoryHash() => r'0be3f9bb9eef6dfff1c486195e2717932c425db1'; +String _$tabRepositoryHash() => r'93afd4b4b6d007f02707bda0b860730b0dba5c5f'; abstract class _$TabRepository extends $Notifier { void build(); diff --git a/app/lib/features/geckoview/features/tabs/domain/repositories/tab.dart b/app/lib/features/geckoview/features/tabs/domain/repositories/tab.dart index ce5049dc..730cb67f 100644 --- a/app/lib/features/geckoview/features/tabs/domain/repositories/tab.dart +++ b/app/lib/features/geckoview/features/tabs/domain/repositories/tab.dart @@ -58,7 +58,7 @@ class TabDataRepository extends _$TabDataRepository { url: tabState.url, private: tabState.isPrivate, container: Value(targetContainer), - parentId: tabState.parentId, + // parentId defaults to null - breaks parent chain when changing contextual identity selectTab: selectedTabId == tabState.id, ); } @@ -86,7 +86,7 @@ class TabDataRepository extends _$TabDataRepository { url: tabState.url, private: tabState.isPrivate, container: const Value(null), - parentId: tabState.parentId, + // parentId defaults to null - breaks parent chain when removing contextual identity selectTab: selectedTabId == tabState.id, ); } diff --git a/app/lib/features/geckoview/features/tabs/domain/repositories/tab.g.dart b/app/lib/features/geckoview/features/tabs/domain/repositories/tab.g.dart index 452f2e3a..00681394 100644 --- a/app/lib/features/geckoview/features/tabs/domain/repositories/tab.g.dart +++ b/app/lib/features/geckoview/features/tabs/domain/repositories/tab.g.dart @@ -41,7 +41,7 @@ final class TabDataRepositoryProvider } } -String _$tabDataRepositoryHash() => r'502f2ce548d3a4d1506d239c9a2e506b9436c408'; +String _$tabDataRepositoryHash() => r'a01c38e94aad2145bd26aa0b8ff0bb1bcceb22f5'; abstract class _$TabDataRepository extends $Notifier { void build();