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