Memo marks itself as valid on update

This commit is contained in:
Sasha Koshka 2024-09-10 16:44:30 -04:00
parent baad6aa227
commit fc1af9f4a1

View File

@ -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
} }