logic improvements
This commit is contained in:
@@ -984,21 +984,12 @@ class TabRepository extends _$TabRepository {
|
|||||||
await selectTab(newTabId);
|
await selectTab(newTabId);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final tabContainerId = await ref
|
|
||||||
.read(tabDataRepositoryProvider.notifier)
|
|
||||||
.getTabContainerId(currentTabState.id);
|
|
||||||
|
|
||||||
if (!ref.mounted) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final latestTabState = ref.read(tabStatesProvider)[tabId];
|
final latestTabState = ref.read(tabStatesProvider)[tabId];
|
||||||
if (latestTabState == null) {
|
if (latestTabState == null) {
|
||||||
logger.w('Could not get tab for assignement ${event.url}');
|
logger.w('Could not get tab for assignement ${event.url}');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetContainerId != tabContainerId) {
|
|
||||||
if (originUri == null) {
|
if (originUri == null) {
|
||||||
await ref
|
await ref
|
||||||
.read(tabDataRepositoryProvider.notifier)
|
.read(tabDataRepositoryProvider.notifier)
|
||||||
@@ -1023,7 +1014,6 @@ class TabRepository extends _$TabRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
logger.w('Could not get tab for assignement ${tabState?.url}');
|
logger.w('Could not get tab for assignement ${tabState?.url}');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,14 @@ class TabDataRepository extends _$TabDataRepository {
|
|||||||
|
|
||||||
final currentContainerData = await getTabContainerData(tabId);
|
final currentContainerData = await getTabContainerData(tabId);
|
||||||
|
|
||||||
|
// The tab is already in the target container, so there is nothing to
|
||||||
|
// reconcile. This guards against churn when an async assignment races a
|
||||||
|
// move that already landed the tab in [targetContainer] (recreating it
|
||||||
|
// here would spawn a redundant tab and re-trigger its load).
|
||||||
|
if (currentContainerData?.id == targetContainer.id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final sameContext =
|
final sameContext =
|
||||||
targetContainer.metadata.contextualIdentity ==
|
targetContainer.metadata.contextualIdentity ==
|
||||||
currentContainerData?.metadata.contextualIdentity;
|
currentContainerData?.metadata.contextualIdentity;
|
||||||
|
|||||||
Reference in New Issue
Block a user