fix container assignment issue
This commit is contained in:
@@ -46,6 +46,11 @@ 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;
|
||||||
@@ -434,6 +439,16 @@ class TabRepository extends _$TabRepository {
|
|||||||
event,
|
event,
|
||||||
) async {
|
) 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) {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ final class TabRepositoryProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$tabRepositoryHash() => r'93afd4b4b6d007f02707bda0b860730b0dba5c5f';
|
String _$tabRepositoryHash() => r'763f5ea734abc854dfdc0c08d3f266fbd94bf931';
|
||||||
|
|
||||||
abstract class _$TabRepository extends $Notifier<void> {
|
abstract class _$TabRepository extends $Notifier<void> {
|
||||||
void build();
|
void build();
|
||||||
|
|||||||
Reference in New Issue
Block a user