kopia lustrzana https://gitlab.com/mysocialportal/relatica
Add riverpodProviderNotReady type for better handling
rodzic
fb70bc7de4
commit
f065e74aad
|
@ -4,6 +4,7 @@
|
|||
|
||||
* Changes
|
||||
* Fixes
|
||||
* Fix error where sometimes profiles would display error screen from notifications panel
|
||||
* New Features
|
||||
|
||||
## Version 0.15.0 (beta)
|
||||
|
|
|
@ -49,6 +49,7 @@ enum ErrorType {
|
|||
notFound,
|
||||
parsingError,
|
||||
rangeError,
|
||||
riveprodProviderNotReady,
|
||||
serverError,
|
||||
timeoutError,
|
||||
}
|
||||
|
|
|
@ -39,13 +39,13 @@ final _crsLogger = Logger('ConnectionsRepoSyncProvider');
|
|||
@Riverpod(keepAlive: true)
|
||||
class _ConnectionsRepoSync extends _$ConnectionsRepoSync {
|
||||
@override
|
||||
Result<IConnectionsRepo, bool> build(Profile profile) {
|
||||
Result<IConnectionsRepo, ExecError> build(Profile profile) {
|
||||
_crsLogger.info('Build $profile');
|
||||
ref.watch(_connectionsRepoProvider(profile).future).then((repo) {
|
||||
state = Result.ok(repo);
|
||||
ref.notifyListeners();
|
||||
});
|
||||
return Result.error(true);
|
||||
return Result.error(ExecError(type: ErrorType.riveprodProviderNotReady));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,8 @@ Result<Connection, ExecError> connectionById(
|
|||
}
|
||||
return c;
|
||||
}).withError((error) {
|
||||
if (error) {
|
||||
if (error is ExecError &&
|
||||
error.type == ErrorType.riveprodProviderNotReady) {
|
||||
return;
|
||||
}
|
||||
final tmpConnection = Connection(id: id);
|
||||
|
|
|
@ -567,7 +567,7 @@ class _MyContactsProviderElement
|
|||
Profile get profile => (origin as MyContactsProvider).profile;
|
||||
}
|
||||
|
||||
String _$connectionByIdHash() => r'ff4468087d99aa56ad40589b4e5a8a73b3eda193';
|
||||
String _$connectionByIdHash() => r'28721c7b361e72b0c5f5ecf16194f08eb4005d52';
|
||||
|
||||
/// See also [connectionById].
|
||||
@ProviderFor(connectionById)
|
||||
|
@ -1154,13 +1154,13 @@ class _SuggestedConnectionsProviderElement
|
|||
}
|
||||
|
||||
String _$connectionsRepoSyncHash() =>
|
||||
r'982c1723afad0c4b4aaccc2949664117856f4944';
|
||||
r'ba59d1737cecf479c187598352a11ad9264a3a67';
|
||||
|
||||
abstract class _$ConnectionsRepoSync
|
||||
extends BuildlessNotifier<Result<IConnectionsRepo, bool>> {
|
||||
extends BuildlessNotifier<Result<IConnectionsRepo, ExecError>> {
|
||||
late final Profile profile;
|
||||
|
||||
Result<IConnectionsRepo, bool> build(
|
||||
Result<IConnectionsRepo, ExecError> build(
|
||||
Profile profile,
|
||||
);
|
||||
}
|
||||
|
@ -1171,7 +1171,7 @@ const _connectionsRepoSyncProvider = _ConnectionsRepoSyncFamily();
|
|||
|
||||
/// See also [_ConnectionsRepoSync].
|
||||
class _ConnectionsRepoSyncFamily
|
||||
extends Family<Result<IConnectionsRepo, bool>> {
|
||||
extends Family<Result<IConnectionsRepo, ExecError>> {
|
||||
/// See also [_ConnectionsRepoSync].
|
||||
const _ConnectionsRepoSyncFamily();
|
||||
|
||||
|
@ -1210,7 +1210,7 @@ class _ConnectionsRepoSyncFamily
|
|||
|
||||
/// See also [_ConnectionsRepoSync].
|
||||
class _ConnectionsRepoSyncProvider extends NotifierProviderImpl<
|
||||
_ConnectionsRepoSync, Result<IConnectionsRepo, bool>> {
|
||||
_ConnectionsRepoSync, Result<IConnectionsRepo, ExecError>> {
|
||||
/// See also [_ConnectionsRepoSync].
|
||||
_ConnectionsRepoSyncProvider(
|
||||
Profile profile,
|
||||
|
@ -1241,7 +1241,7 @@ class _ConnectionsRepoSyncProvider extends NotifierProviderImpl<
|
|||
final Profile profile;
|
||||
|
||||
@override
|
||||
Result<IConnectionsRepo, bool> runNotifierBuild(
|
||||
Result<IConnectionsRepo, ExecError> runNotifierBuild(
|
||||
covariant _ConnectionsRepoSync notifier,
|
||||
) {
|
||||
return notifier.build(
|
||||
|
@ -1266,8 +1266,8 @@ class _ConnectionsRepoSyncProvider extends NotifierProviderImpl<
|
|||
}
|
||||
|
||||
@override
|
||||
NotifierProviderElement<_ConnectionsRepoSync, Result<IConnectionsRepo, bool>>
|
||||
createElement() {
|
||||
NotifierProviderElement<_ConnectionsRepoSync,
|
||||
Result<IConnectionsRepo, ExecError>> createElement() {
|
||||
return _ConnectionsRepoSyncProviderElement(this);
|
||||
}
|
||||
|
||||
|
@ -1288,14 +1288,14 @@ class _ConnectionsRepoSyncProvider extends NotifierProviderImpl<
|
|||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
mixin _ConnectionsRepoSyncRef
|
||||
on NotifierProviderRef<Result<IConnectionsRepo, bool>> {
|
||||
on NotifierProviderRef<Result<IConnectionsRepo, ExecError>> {
|
||||
/// The parameter `profile` of this provider.
|
||||
Profile get profile;
|
||||
}
|
||||
|
||||
class _ConnectionsRepoSyncProviderElement extends NotifierProviderElement<
|
||||
_ConnectionsRepoSync,
|
||||
Result<IConnectionsRepo, bool>> with _ConnectionsRepoSyncRef {
|
||||
Result<IConnectionsRepo, ExecError>> with _ConnectionsRepoSyncRef {
|
||||
_ConnectionsRepoSyncProviderElement(super.provider);
|
||||
|
||||
@override
|
||||
|
|
Ładowanie…
Reference in New Issue