Memo marks itself as valid on update
This commit is contained in:
parent
baad6aa227
commit
fc1af9f4a1
@ -20,6 +20,7 @@ func NewMemo[T any] (update func () T) Memo[T] {
|
|||||||
func (this *Memo[T]) Value () T {
|
func (this *Memo[T]) Value () T {
|
||||||
if !this.valid {
|
if !this.valid {
|
||||||
this.cache = this.update()
|
this.cache = this.update()
|
||||||
|
this.valid = true
|
||||||
}
|
}
|
||||||
return this.cache
|
return this.cache
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user