diff --git a/Sources/SharingGRDB/Documentation.docc/Articles/DynamicQueries.md b/Sources/SharingGRDB/Documentation.docc/Articles/DynamicQueries.md index f9a9a6a..57b97dd 100644 --- a/Sources/SharingGRDB/Documentation.docc/Articles/DynamicQueries.md +++ b/Sources/SharingGRDB/Documentation.docc/Articles/DynamicQueries.md @@ -57,13 +57,17 @@ struct ContentView: View { List { // ... } - .onChange(of: [filterDate, order] as [AnyHashable], initial: true) { - updateQuery() + .task(id: [filter, ordering] as [AnyHashable]) { + await updateQuery() } } - private func updateQuery() { - $items.load(.fetch(Items(filterDate: filterDate, order: order))) + private func updateQuery() async { + do { + try await $items.load(.fetch(Items(filterDate: filterDate, order: order))) + } catch { + // Handle error... + } } private struct Items: FetchKeyRequest {