Skip to content

Commit

Permalink
fixed dirty tracking in ASet.flattenA/mapA/filterA/chooseA/ofSetTree/…
Browse files Browse the repository at this point in the history
…ofListTree when application also uses AdaptiveObject.Tag of inputs
  • Loading branch information
luithefirst committed Mar 4, 2025
1 parent 166cdb2 commit 5162cfc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 1.2.23
- fixed dirty tracking in ASet.flattenA/mapA/filterA/chooseA/ofSetTree/ofListTree when application also uses AdaptiveObject.Tag of inputs

### 1.2.22
- fixed exception in ASet.ofSetTree/ofListTree

Expand Down
10 changes: 5 additions & 5 deletions src/FSharp.Data.Adaptive/AdaptiveHashSet/AdaptiveHashSet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ module AdaptiveHashSetImplementation =
/// Reader for flattenA
[<Sealed>]
type FlattenAReader<'T>(input : aset<aval<'T>>) =
inherit AbstractDirtyReader<aval<'T>, HashSetDelta<'T>>(HashSetDelta.monoid, isNull)
inherit AbstractDirtyReader<aval<'T>, HashSetDelta<'T>>(HashSetDelta.monoid, (<>) "Input")

let r = input.GetReader()
do r.Tag <- "Input"
Expand Down Expand Up @@ -976,7 +976,7 @@ module AdaptiveHashSetImplementation =
/// Reader for mapA
[<Sealed>]
type MapAReader<'A, 'B>(input : aset<'A>, mapping : 'A -> aval<'B>) =
inherit AbstractDirtyReader<aval<'B>, HashSetDelta<'B>>(HashSetDelta.monoid, isNull)
inherit AbstractDirtyReader<aval<'B>, HashSetDelta<'B>>(HashSetDelta.monoid, (<>) "Reader")

let reader = input.GetReader()
do reader.Tag <- "Reader"
Expand Down Expand Up @@ -1038,7 +1038,7 @@ module AdaptiveHashSetImplementation =
/// Reader for chooseA
[<Sealed>]
type ChooseAReader<'A, 'B>(input : aset<'A>, f : 'A -> aval<option<'B>>) =
inherit AbstractDirtyReader<aval<option<'B>>, HashSetDelta<'B>>(HashSetDelta.monoid, isNull)
inherit AbstractDirtyReader<aval<option<'B>>, HashSetDelta<'B>>(HashSetDelta.monoid, (<>) "Reader")

let r = input.GetReader()
do r.Tag <- "Reader"
Expand Down Expand Up @@ -1129,7 +1129,7 @@ module AdaptiveHashSetImplementation =
/// Reader for filterA
[<Sealed>]
type FilterAReader<'A>(input : aset<'A>, predicate : 'A -> aval<bool>) =
inherit AbstractDirtyReader<aval<bool>, HashSetDelta<'A>>(HashSetDelta.monoid, isNull)
inherit AbstractDirtyReader<aval<bool>, HashSetDelta<'A>>(HashSetDelta.monoid, (<>) "Reader")

let r = input.GetReader()
do r.Tag <- "Reader"
Expand Down Expand Up @@ -1229,7 +1229,7 @@ module AdaptiveHashSetImplementation =
()
| _ -> unexpected()

| _ -> () // aval<bool> expected to have been removed in this udpate
| _ -> () // aval<bool> expected to have been removed in this update

deltas

Expand Down
4 changes: 2 additions & 2 deletions src/FSharp.Data.Adaptive/CollectionExtensions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ module CollectionExtensions =
/// Reader for ASet.ofListTree
[<Sealed>]
type ListTreeReader<'T>(list: alist<'T>, getChildren : 'T -> alist<'T>) =
inherit AbstractDirtyReader<IIndexListReader<'T>, HashSetDelta<'T>>(HashSetDelta.monoid, isNull)
inherit AbstractDirtyReader<IIndexListReader<'T>, HashSetDelta<'T>>(HashSetDelta.monoid, fun _ -> true)

let mutable initial = true
let reader = list.GetReader() // NOTE: need to be held, otherwise it will be collected and no updates can be consumed
Expand Down Expand Up @@ -361,7 +361,7 @@ module CollectionExtensions =
/// Reader for ASet.ofSetTree (delta combine)
[<Sealed>]
type SetTreeReader<'T>(set: aset<'T>, getChildren : 'T -> aset<'T>) =
inherit AbstractDirtyReader<IHashSetReader<'T>, HashSetDelta<'T>>(HashSetDelta.monoid, isNull)
inherit AbstractDirtyReader<IHashSetReader<'T>, HashSetDelta<'T>>(HashSetDelta.monoid, fun _ -> true)

let mutable initial = true
let reader = set.GetReader() // NOTE: need to be held, otherwise it will be collected and no updates can be consumed
Expand Down

0 comments on commit 5162cfc

Please sign in to comment.