revert tab processed memory; close assigned tab when history empty;
This commit is contained in:
@@ -46,11 +46,6 @@ class TabRepository extends _$TabRepository {
|
|||||||
|
|
||||||
final _tabFromIntent = <String>{};
|
final _tabFromIntent = <String>{};
|
||||||
|
|
||||||
/// Tracks tabs currently being processed for container assignment to prevent
|
|
||||||
/// concurrent processing of the same tab (race condition protection)
|
|
||||||
/// See: https://github.com/FaFre/WebLibre/issues/139
|
|
||||||
final _tabsBeingProcessedForAssignment = <String>{};
|
|
||||||
|
|
||||||
bool hasLaunchedFromIntent(String? tabId) {
|
bool hasLaunchedFromIntent(String? tabId) {
|
||||||
if (tabId == null) {
|
if (tabId == null) {
|
||||||
return false;
|
return false;
|
||||||
@@ -447,16 +442,6 @@ class TabRepository extends _$TabRepository {
|
|||||||
final containerSiteAssignementSub = eventSerivce.siteAssignementEvent.listen(
|
final containerSiteAssignementSub = eventSerivce.siteAssignementEvent.listen(
|
||||||
(event) async {
|
(event) async {
|
||||||
if (event.tabId != null) {
|
if (event.tabId != null) {
|
||||||
// Prevent concurrent processing of the same tab (race condition protection)
|
|
||||||
if (_tabsBeingProcessedForAssignment.contains(event.tabId)) {
|
|
||||||
logger.d(
|
|
||||||
'Skipping container assignment for tab ${event.tabId} - already being processed',
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_tabsBeingProcessedForAssignment.add(event.tabId!);
|
|
||||||
|
|
||||||
// ignore: only_use_keep_alive_inside_keep_alive
|
// ignore: only_use_keep_alive_inside_keep_alive
|
||||||
final tabState = ref.read(tabStateProvider(event.tabId));
|
final tabState = ref.read(tabStateProvider(event.tabId));
|
||||||
if (tabState != null) {
|
if (tabState != null) {
|
||||||
@@ -497,7 +482,7 @@ class TabRepository extends _$TabRepository {
|
|||||||
selectTab: true,
|
selectTab: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (tabIsEmpty) {
|
if (tabState.historyState.items.isEmpty) {
|
||||||
await closeTab(tabState.id);
|
await closeTab(tabState.id);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ final class TabRepositoryProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$tabRepositoryHash() => r'ff8ce73a65d408587cfb41e1920332d15ddff55f';
|
String _$tabRepositoryHash() => r'6f3ddaa1929de2a6f8fed0e818802ab69baee220';
|
||||||
|
|
||||||
abstract class _$TabRepository extends $Notifier<void> {
|
abstract class _$TabRepository extends $Notifier<void> {
|
||||||
void build();
|
void build();
|
||||||
|
|||||||
Reference in New Issue
Block a user