Fix connectionById (and others) not refreshing when repo became available

merge-requests/67/merge
Hank Grabowski 2024-12-19 11:49:40 -05:00
rodzic 9a6cbbb9f0
commit 262a178696
3 zmienionych plików z 12 dodań i 9 usunięć

2
.gitignore vendored
Wyświetl plik

@ -5,9 +5,11 @@
*.swp *.swp
.DS_Store .DS_Store
.atom/ .atom/
.build/
.buildlog/ .buildlog/
.history .history
.svn/ .svn/
.swiftpm/
migrate_working_dir/ migrate_working_dir/
# IntelliJ related # IntelliJ related

Wyświetl plik

@ -39,9 +39,10 @@ class _ConnectionsRepoSync extends _$ConnectionsRepoSync {
@override @override
Result<IConnectionsRepo, bool> build(Profile profile) { Result<IConnectionsRepo, bool> build(Profile profile) {
_crsLogger.info('Build $profile'); _crsLogger.info('Build $profile');
ref ref.watch(_connectionsRepoProvider(profile).future).then((repo) {
.watch(_connectionsRepoProvider(profile).future) state = Result.ok(repo);
.then((repo) => state = Result.ok(repo)); ref.notifyListeners();
});
return Result.error(true); return Result.error(true);
} }
} }
@ -88,7 +89,7 @@ Result<Connection, ExecError> connectionById(
{bool forceUpdate = false}) { {bool forceUpdate = false}) {
_cbiLogger.finest('Build for $id for $profile'); _cbiLogger.finest('Build for $id for $profile');
final result = ref final result = ref
.read(_connectionsRepoSyncProvider(profile)) .watch(_connectionsRepoSyncProvider(profile))
.andThen((repo) => repo.getById(id)) .andThen((repo) => repo.getById(id))
.transform((c) { .transform((c) {
if (c.status == ConnectionStatus.unknown && forceUpdate) { if (c.status == ConnectionStatus.unknown && forceUpdate) {
@ -117,7 +118,7 @@ Result<Connection, ExecError> connectionByHandle(
Ref ref, Profile profile, String handle) { Ref ref, Profile profile, String handle) {
_cbhLogger.finest('Build for $handle for $profile'); _cbhLogger.finest('Build for $handle for $profile');
return ref return ref
.read(_connectionsRepoSyncProvider(profile)) .watch(_connectionsRepoSyncProvider(profile))
.andThen((repo) => repo.getByHandle(handle)) .andThen((repo) => repo.getByHandle(handle))
.execErrorCast(); .execErrorCast();
} }

Wyświetl plik

@ -641,10 +641,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: http_parser name: http_parser
sha256: "76d306a1c3afb33fe82e2bbacad62a61f409b5634c915fceb0d799de1a913360" sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "4.1.1" version: "4.0.2"
image: image:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1321,10 +1321,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: shelf name: shelf
sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12 sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.4.2" version: "1.4.1"
shelf_web_socket: shelf_web_socket:
dependency: transitive dependency: transitive
description: description: