Skip to content

Commit 8554dfb

Browse files
committed
Dont allow observing a write
1 parent 86e5107 commit 8554dfb

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

Sources/Feather/FeatherError.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ public enum FeatherError: Error {
2626
case decodingError(String)
2727
case encodingError(String)
2828
case requiredAssociationFailed(parent: String, childKey: String)
29+
case cannotObserveWriteQuery
2930
}

Sources/Feather/QueryObservation.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ public final class DatabaseQueryObservation<Query>: DatabaseSubscriber, QueryObs
6161
}
6262

6363
do {
64+
guard query.transactionKind != .write else {
65+
throw FeatherError.cannotObserveWriteQuery
66+
}
67+
6468
let output = try await query.execute(with: input)
6569
onChange(output)
6670
} catch {

0 commit comments

Comments
 (0)