fix lifecycle issues
This commit is contained in:
@@ -346,6 +346,7 @@ class GenericWebsiteService extends _$GenericWebsiteService {
|
||||
return cachedIcon;
|
||||
}
|
||||
|
||||
// ignore: only_use_keep_alive_inside_keep_alive
|
||||
final result = await ref.read(
|
||||
pageInfoProvider(url, isImageRequest: true).future,
|
||||
);
|
||||
|
||||
@@ -46,6 +46,7 @@ GeckoSelectionActionService selectionActionService(Ref ref) {
|
||||
final settings = ref.read(generalSettingsWithDefaultsProvider);
|
||||
final route = SearchRoute(
|
||||
tabType:
|
||||
// ignore: only_use_keep_alive_inside_keep_alive
|
||||
ref.read(selectedTabTypeProvider) ??
|
||||
settings.defaultCreateTabType,
|
||||
searchText: text,
|
||||
@@ -59,6 +60,7 @@ GeckoSelectionActionService selectionActionService(Ref ref) {
|
||||
);
|
||||
|
||||
if (defaultSearchBang != null) {
|
||||
// ignore: only_use_keep_alive_inside_keep_alive
|
||||
final currentTab = ref.read(selectedTabStateProvider);
|
||||
final isPrivate =
|
||||
currentTab?.isPrivate ??
|
||||
@@ -81,6 +83,7 @@ GeckoSelectionActionService selectionActionService(Ref ref) {
|
||||
FindInPageAction((text) async {
|
||||
final tabId = ref.read(selectedTabProvider);
|
||||
if (tabId != null) {
|
||||
// ignore: only_use_keep_alive_inside_keep_alive
|
||||
await ref
|
||||
.read(findInPageControllerProvider(tabId).notifier)
|
||||
.findAll(text: text);
|
||||
|
||||
@@ -245,7 +245,7 @@ TabType? selectedTabType(Ref ref) {
|
||||
);
|
||||
}
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
@Riverpod()
|
||||
AsyncValue<String?> selectedTabContainerId(Ref ref) {
|
||||
final tabId = ref.watch(selectedTabProvider);
|
||||
if (tabId != null) {
|
||||
|
||||
@@ -238,7 +238,7 @@ final class SelectedTabContainerIdProvider
|
||||
argument: null,
|
||||
retry: null,
|
||||
name: r'selectedTabContainerIdProvider',
|
||||
isAutoDispose: false,
|
||||
isAutoDispose: true,
|
||||
dependencies: null,
|
||||
$allTransitiveDependencies: null,
|
||||
);
|
||||
@@ -267,7 +267,7 @@ final class SelectedTabContainerIdProvider
|
||||
}
|
||||
|
||||
String _$selectedTabContainerIdHash() =>
|
||||
r'9f0246a02a069b1a66211a3924f32e9d75f0f344';
|
||||
r'07899d29f69654d3b314d0da945ad402b1003b41';
|
||||
|
||||
@ProviderFor(tabScrollY)
|
||||
const tabScrollYProvider = TabScrollYFamily._();
|
||||
|
||||
@@ -69,6 +69,7 @@ class TabRepository extends _$TabRepository {
|
||||
final assingedContainer =
|
||||
container ??
|
||||
Value<ContainerData?>(
|
||||
// ignore: only_use_keep_alive_inside_keep_alive
|
||||
await ref.read(selectedContainerProvider.notifier).fetchData(),
|
||||
);
|
||||
|
||||
@@ -183,6 +184,7 @@ class TabRepository extends _$TabRepository {
|
||||
|
||||
if (containerData != null) {
|
||||
if (containerData.metadata.authSettings.authenticationRequired) {
|
||||
// ignore: only_use_keep_alive_inside_keep_alive
|
||||
if (containerId != ref.read(selectedContainerProvider)) {
|
||||
logger.w(
|
||||
'Tried to open authenticated tab $tabId but container not selected',
|
||||
@@ -295,6 +297,7 @@ class TabRepository extends _$TabRepository {
|
||||
final db = ref.watch(tabDatabaseProvider);
|
||||
|
||||
final tabAddedSub = eventSerivce.tabAddedStream.listen((tabId) async {
|
||||
// ignore: only_use_keep_alive_inside_keep_alive
|
||||
final containerId = ref.read(selectedContainerProvider);
|
||||
await db.tabDao.upsertUnassignedTab(
|
||||
tabId,
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import 'package:weblibre/features/geckoview/features/find_in_page/domain/reposit
|
||||
|
||||
part 'find_in_page.g.dart';
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
@Riverpod()
|
||||
class FindInPageController extends _$FindInPageController {
|
||||
void show() {
|
||||
state = state.copyWith.visible(true);
|
||||
|
||||
+3
-3
@@ -20,7 +20,7 @@ final class FindInPageControllerProvider
|
||||
}) : super(
|
||||
retry: null,
|
||||
name: r'findInPageControllerProvider',
|
||||
isAutoDispose: false,
|
||||
isAutoDispose: true,
|
||||
dependencies: null,
|
||||
$allTransitiveDependencies: null,
|
||||
);
|
||||
@@ -59,7 +59,7 @@ final class FindInPageControllerProvider
|
||||
}
|
||||
|
||||
String _$findInPageControllerHash() =>
|
||||
r'da72e38225809af5c78a372e949a80207d7ce7c9';
|
||||
r'85e6b69edcd66a961d51326b01336a969d37fac1';
|
||||
|
||||
final class FindInPageControllerFamily extends $Family
|
||||
with
|
||||
@@ -76,7 +76,7 @@ final class FindInPageControllerFamily extends $Family
|
||||
name: r'findInPageControllerProvider',
|
||||
dependencies: null,
|
||||
$allTransitiveDependencies: null,
|
||||
isAutoDispose: false,
|
||||
isAutoDispose: true,
|
||||
);
|
||||
|
||||
FindInPageControllerProvider call(String tabId) =>
|
||||
|
||||
@@ -28,7 +28,7 @@ import 'package:weblibre/features/search/util/tokenized_filter.dart';
|
||||
|
||||
part 'providers.g.dart';
|
||||
|
||||
@Riverpod()
|
||||
@Riverpod(keepAlive: true)
|
||||
Stream<List<ContainerDataWithCount>> containersWithCount(Ref ref) {
|
||||
final db = ref.watch(tabDatabaseProvider);
|
||||
return db.definitionsDrift.containersWithCount().watch();
|
||||
|
||||
@@ -28,7 +28,7 @@ final class ContainersWithCountProvider
|
||||
argument: null,
|
||||
retry: null,
|
||||
name: r'containersWithCountProvider',
|
||||
isAutoDispose: true,
|
||||
isAutoDispose: false,
|
||||
dependencies: null,
|
||||
$allTransitiveDependencies: null,
|
||||
);
|
||||
@@ -49,7 +49,7 @@ final class ContainersWithCountProvider
|
||||
}
|
||||
|
||||
String _$containersWithCountHash() =>
|
||||
r'd08294ef0def19b3401552fa9d533c9a780fa3dd';
|
||||
r'757bb0102afedc07ef0f80a420b4c87cbdbed3e1';
|
||||
|
||||
@ProviderFor(matchSortedContainersWithCount)
|
||||
const matchSortedContainersWithCountProvider =
|
||||
|
||||
@@ -33,7 +33,7 @@ part 'selected_container.g.dart';
|
||||
|
||||
enum SetContainerResult { failed, success, successHasProxy }
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
@Riverpod()
|
||||
class SelectedContainer extends _$SelectedContainer {
|
||||
Future<ContainerData?> fetchData() async {
|
||||
if (state != null) {
|
||||
|
||||
@@ -20,7 +20,7 @@ final class SelectedContainerProvider
|
||||
argument: null,
|
||||
retry: null,
|
||||
name: r'selectedContainerProvider',
|
||||
isAutoDispose: false,
|
||||
isAutoDispose: true,
|
||||
dependencies: null,
|
||||
$allTransitiveDependencies: null,
|
||||
);
|
||||
@@ -41,7 +41,7 @@ final class SelectedContainerProvider
|
||||
}
|
||||
}
|
||||
|
||||
String _$selectedContainerHash() => r'9e9a9b5e3c91ff1fbf8544e329524f8e064587fe';
|
||||
String _$selectedContainerHash() => r'78a43c90ad5e4906ebb33f6b865b23adeb4cae8f';
|
||||
|
||||
abstract class _$SelectedContainer extends $Notifier<String?> {
|
||||
String? build();
|
||||
|
||||
@@ -176,7 +176,7 @@ class GeckoInferenceRepository extends _$GeckoInferenceRepository {
|
||||
void build() {}
|
||||
}
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
@Riverpod()
|
||||
Future<String?> containerTopic(Ref ref, String containerId) async {
|
||||
final titles = await ref.watch(
|
||||
containerTabsDataProvider(containerId).selectAsync(
|
||||
@@ -189,6 +189,10 @@ Future<String?> containerTopic(Ref ref, String containerId) async {
|
||||
.read(geckoInferenceRepositoryProvider.notifier)
|
||||
.predictDocumentTopic(titles.value);
|
||||
|
||||
if (topic.isNotEmpty) {
|
||||
ref.keepAlive();
|
||||
}
|
||||
|
||||
return topic;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ final class ContainerTopicProvider
|
||||
}) : super(
|
||||
retry: null,
|
||||
name: r'containerTopicProvider',
|
||||
isAutoDispose: false,
|
||||
isAutoDispose: true,
|
||||
dependencies: null,
|
||||
$allTransitiveDependencies: null,
|
||||
);
|
||||
@@ -112,7 +112,7 @@ final class ContainerTopicProvider
|
||||
}
|
||||
}
|
||||
|
||||
String _$containerTopicHash() => r'b680381eab3dded9ca6f174fbcc5da5c59d7e9f0';
|
||||
String _$containerTopicHash() => r'dd2af0571a84f9cc2536af6a1079e7ee58e2a0a5';
|
||||
|
||||
final class ContainerTopicFamily extends $Family
|
||||
with $FunctionalFamilyOverride<FutureOr<String?>, String> {
|
||||
@@ -122,7 +122,7 @@ final class ContainerTopicFamily extends $Family
|
||||
name: r'containerTopicProvider',
|
||||
dependencies: null,
|
||||
$allTransitiveDependencies: null,
|
||||
isAutoDispose: false,
|
||||
isAutoDispose: true,
|
||||
);
|
||||
|
||||
ContainerTopicProvider call(String containerId) =>
|
||||
|
||||
@@ -138,6 +138,7 @@ class TorProxyService extends _$TorProxyService {
|
||||
|
||||
if (config == null && torSettings.requireBridge) {
|
||||
config = MoatService.convertBuiltinToSettings(
|
||||
// ignore: only_use_keep_alive_inside_keep_alive
|
||||
await ref
|
||||
.read(builtinBridgesRepositoryProvider(moat).notifier)
|
||||
.getBridges(),
|
||||
@@ -170,6 +171,7 @@ class TorProxyService extends _$TorProxyService {
|
||||
|
||||
if (config == null && torSettings.requireBridge) {
|
||||
config = MoatService.convertBuiltinToSettings(
|
||||
// ignore: only_use_keep_alive_inside_keep_alive
|
||||
await ref
|
||||
.read(builtinBridgesRepositoryProvider(moat).notifier)
|
||||
.getBridges(tryUpdate: torSettings.fetchRemoteBridges),
|
||||
|
||||
@@ -145,7 +145,7 @@ class GeneralSettingsRepository extends _$GeneralSettingsRepository {
|
||||
}
|
||||
}
|
||||
|
||||
@Riverpod()
|
||||
@Riverpod(keepAlive: true)
|
||||
GeneralSettings generalSettingsWithDefaults(Ref ref) {
|
||||
return ref.watch(
|
||||
generalSettingsRepositoryProvider.select(
|
||||
|
||||
@@ -71,7 +71,7 @@ final class GeneralSettingsWithDefaultsProvider
|
||||
argument: null,
|
||||
retry: null,
|
||||
name: r'generalSettingsWithDefaultsProvider',
|
||||
isAutoDispose: true,
|
||||
isAutoDispose: false,
|
||||
dependencies: null,
|
||||
$allTransitiveDependencies: null,
|
||||
);
|
||||
@@ -99,4 +99,4 @@ final class GeneralSettingsWithDefaultsProvider
|
||||
}
|
||||
|
||||
String _$generalSettingsWithDefaultsHash() =>
|
||||
r'4b8ccd2d9ce6a07fd342a0a663d822f8c658655d';
|
||||
r'9da4a00a3500286fbf515ee319fa911bfacab40e';
|
||||
|
||||
@@ -94,7 +94,7 @@ class TorSettingsRepository extends _$TorSettingsRepository {
|
||||
}
|
||||
}
|
||||
|
||||
@Riverpod()
|
||||
@Riverpod(keepAlive: true)
|
||||
TorSettings torSettingsWithDefaults(Ref ref) {
|
||||
return ref.watch(
|
||||
torSettingsRepositoryProvider.select(
|
||||
|
||||
@@ -67,7 +67,7 @@ final class TorSettingsWithDefaultsProvider
|
||||
argument: null,
|
||||
retry: null,
|
||||
name: r'torSettingsWithDefaultsProvider',
|
||||
isAutoDispose: true,
|
||||
isAutoDispose: false,
|
||||
dependencies: null,
|
||||
$allTransitiveDependencies: null,
|
||||
);
|
||||
@@ -95,4 +95,4 @@ final class TorSettingsWithDefaultsProvider
|
||||
}
|
||||
|
||||
String _$torSettingsWithDefaultsHash() =>
|
||||
r'47005584ad9d3445a8dfa54ffcd0987763997003';
|
||||
r'501a7ed7f14870d40b8f60303d3c385a45d9f542';
|
||||
|
||||
Reference in New Issue
Block a user