Skip to content

Commit

Permalink
Avoid capturing StateValue in closure
Browse files Browse the repository at this point in the history
  • Loading branch information
Timothé Larivière committed Mar 22, 2024
1 parent feb42dd commit 177b6e4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Fabulous/Binding.fs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ type BindingExtensions =
| ValueSome d -> d.Dispose()

// Subscribe to source context changes
let sourceKey = stateValue.Key

let sub =
stateValue.Context.RenderNeeded.Subscribe(fun k ->
if k = stateValue.Key then
if k = sourceKey then
ctx.NeedsRender(key))

ctx.SetValueInternal(key, sub)
Expand Down

0 comments on commit 177b6e4

Please sign in to comment.