provider ref.mounted hardenings
This commit is contained in:
@@ -191,12 +191,18 @@ class EngineReadyState extends _$EngineReadyState {
|
||||
return true;
|
||||
},
|
||||
)
|
||||
.whenComplete(() => state = true),
|
||||
.whenComplete(() {
|
||||
if (ref.mounted) {
|
||||
state = true;
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
final sub = eventService.engineReadyStateEvents.listen((value) {
|
||||
state = value;
|
||||
if (ref.mounted) {
|
||||
state = value;
|
||||
}
|
||||
});
|
||||
|
||||
ref.onDispose(() async {
|
||||
@@ -223,6 +229,8 @@ class MlDownloadState extends _$MlDownloadState {
|
||||
MlProgressData? build() {
|
||||
ref.listen(mlProgressEventsProvider, (previous, next) {
|
||||
next.whenData((progress) {
|
||||
if (!ref.mounted) return;
|
||||
|
||||
if (progress.type == MlProgressType.downloading) {
|
||||
if (progress.status == MlProgressStatus.done) {
|
||||
// Keep showing for 2 seconds after completion
|
||||
|
||||
@@ -278,7 +278,7 @@ final class EngineReadyStateProvider
|
||||
}
|
||||
}
|
||||
|
||||
String _$engineReadyStateHash() => r'a892c48ffc29e3414de12e66d9bfec522e4f40a8';
|
||||
String _$engineReadyStateHash() => r'ab3fe385fbda4d7d8acaf8f5428b3b48b75f3f46';
|
||||
|
||||
abstract class _$EngineReadyState extends $Notifier<bool> {
|
||||
bool build();
|
||||
@@ -378,7 +378,7 @@ final class MlDownloadStateProvider
|
||||
}
|
||||
}
|
||||
|
||||
String _$mlDownloadStateHash() => r'a6e2612770878a9fc5ca6800665698c6335a047e';
|
||||
String _$mlDownloadStateHash() => r'4b943f0a950bf63c9a1b628d4104fdd6fa0d8d07';
|
||||
|
||||
/// Tracks active ML model downloads
|
||||
|
||||
|
||||
@@ -71,7 +71,9 @@ class SelectedBangData extends _$SelectedBangData {
|
||||
final subscription = repository.watchBang(selectedBangTrigger).listen((
|
||||
value,
|
||||
) {
|
||||
state = value;
|
||||
if (ref.mounted) {
|
||||
state = value;
|
||||
}
|
||||
});
|
||||
|
||||
ref.onDispose(() async {
|
||||
|
||||
@@ -156,7 +156,7 @@ final class SelectedBangDataProvider
|
||||
}
|
||||
}
|
||||
|
||||
String _$selectedBangDataHash() => r'666858556efe59d2de38a04fda30e8ec227c6675';
|
||||
String _$selectedBangDataHash() => r'68bdd0d203cc47a0d26904ecb30651b58aa19486';
|
||||
|
||||
final class SelectedBangDataFamily extends $Family
|
||||
with
|
||||
|
||||
+1
@@ -72,6 +72,7 @@ class FindInPageController extends _$FindInPageController {
|
||||
fireImmediately: true,
|
||||
tabStateProvider(tabId),
|
||||
(previous, next) async {
|
||||
if (!ref.mounted) return;
|
||||
//Ensure state is already initialized
|
||||
if (stateOrNull != null) {
|
||||
if (state.visible && state.lastSearchText.isNotEmpty) {
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ final class FindInPageControllerProvider
|
||||
}
|
||||
|
||||
String _$findInPageControllerHash() =>
|
||||
r'85e6b69edcd66a961d51326b01336a969d37fac1';
|
||||
r'4aaa0c4b4a623e7274836e70e5f66e97a3ebf80a';
|
||||
|
||||
final class FindInPageControllerFamily extends $Family
|
||||
with
|
||||
|
||||
Reference in New Issue
Block a user