diff --git a/docs/api-reference/graph/types/graphobject.md b/docs/api-reference/graph/types/graphobject.md
index 03d02b135..ef2fafa15 100644
--- a/docs/api-reference/graph/types/graphobject.md
+++ b/docs/api-reference/graph/types/graphobject.md
@@ -15,9 +15,10 @@ export type GraphObject = ScopedObject & {
dependencySet: {[GraphObject]: unknown},
dependentSet: {[GraphObject]: unknown},
lastChange: number?,
+ lastCompute: number?,
timeliness: "lazy" | "eager",
validity: "valid" | "invalid" | "busy",
- _evaluate: (GraphObject, lastChange: number?) -> boolean
+ _evaluate: (GraphObject) -> boolean
}
```
@@ -75,6 +76,16 @@ object.
The `os.clock()` time of this object's most recent meaningful change, or `nil`
if the object is newly created.
+
+ lastCompute
+
+ : number?
+
+
+
+The `os.clock()` time of when this object was most recently computed, or `nil`
+if the object is newly created.
+
timeliness
diff --git a/src/Animation/ExternalTime.luau b/src/Animation/ExternalTime.luau
index 8e18ce204..e3adfaf26 100644
--- a/src/Animation/ExternalTime.luau
+++ b/src/Animation/ExternalTime.luau
@@ -39,6 +39,7 @@ local function ExternalTime(
createdAt = createdAt,
dependentSet = {},
lastChange = nil,
+ lastCompute = nil,
scope = scope,
validity = "invalid"
},
diff --git a/src/Animation/Spring.luau b/src/Animation/Spring.luau
index 9b95cdbba..4b781e74d 100644
--- a/src/Animation/Spring.luau
+++ b/src/Animation/Spring.luau
@@ -84,6 +84,7 @@ local function Spring(
dependencySet = {},
dependentSet = {},
lastChange = nil,
+ lastCompute = nil,
scope = scope,
validity = "invalid",
_activeDamping = -1,
diff --git a/src/Animation/Stopwatch.luau b/src/Animation/Stopwatch.luau
index b2e330c9b..f93a56edd 100644
--- a/src/Animation/Stopwatch.luau
+++ b/src/Animation/Stopwatch.luau
@@ -53,6 +53,7 @@ local function Stopwatch(
dependencySet = {},
dependentSet = {},
lastChange = nil,
+ lastCompute = nil,
scope = scope,
validity = "invalid",
_EXTREMELY_DANGEROUS_usedAsValue = 0,
diff --git a/src/Animation/Tween.luau b/src/Animation/Tween.luau
index f8d042ed3..30975c911 100644
--- a/src/Animation/Tween.luau
+++ b/src/Animation/Tween.luau
@@ -70,6 +70,7 @@ local function Tween(
dependencySet = {},
dependentSet = {},
lastChange = nil,
+ lastCompute = nil,
scope = scope,
validity = "invalid",
_activeDuration = nil,
diff --git a/src/Graph/evaluate.luau b/src/Graph/evaluate.luau
index 59c747fd8..6161fd17e 100644
--- a/src/Graph/evaluate.luau
+++ b/src/Graph/evaluate.luau
@@ -21,14 +21,14 @@ local function evaluate(
if target.validity == "busy" then
return External.logError("infiniteLoop")
end
- local firstEvaluation = target.lastChange == nil
+ local firstEvaluation = target.lastCompute == nil or target.lastChange == nil
local isInvalid = target.validity == "invalid"
if firstEvaluation or isInvalid or forceComputation then
local needsComputation = firstEvaluation or forceComputation
if not needsComputation then
for dependency in target.dependencySet do
evaluate(dependency, false)
- if dependency.lastChange > target.lastChange then
+ if dependency.lastChange > target.lastCompute then
needsComputation = true
break
end
@@ -42,6 +42,7 @@ local function evaluate(
end
target.validity = "busy"
targetMeaningfullyChanged = target:_evaluate() or firstEvaluation
+ target.lastCompute = os.clock()
end
if targetMeaningfullyChanged then
target.lastChange = os.clock()
diff --git a/src/State/Computed.luau b/src/State/Computed.luau
index df09ed2fb..0603269b4 100644
--- a/src/State/Computed.luau
+++ b/src/State/Computed.luau
@@ -60,6 +60,7 @@ local function Computed(
dependencySet = {},
dependentSet = {},
lastChange = nil,
+ lastCompute = nil,
scope = scope,
validity = "invalid",
_EXTREMELY_DANGEROUS_usedAsValue = nil,
diff --git a/src/State/Value.luau b/src/State/Value.luau
index b96802543..11f3539e1 100644
--- a/src/State/Value.luau
+++ b/src/State/Value.luau
@@ -42,6 +42,7 @@ local function Value(
createdAt = createdAt,
dependentSet = {},
lastChange = os.clock(),
+ lastCompute = os.clock(),
scope = scope,
validity = "valid",
_EXTREMELY_DANGEROUS_usedAsValue = initialValue
diff --git a/src/Types.luau b/src/Types.luau
index ddecd4092..d26737e47 100644
--- a/src/Types.luau
+++ b/src/Types.luau
@@ -78,6 +78,7 @@ export type GraphObject = ScopedObject & {
dependencySet: {[GraphObject]: unknown},
dependentSet: {[GraphObject]: unknown},
lastChange: number?,
+ lastCompute: number?,
timeliness: "lazy" | "eager",
validity: "valid" | "invalid" | "busy",
_evaluate: (GraphObject) -> boolean
diff --git a/test/Spec/Graph/evaluate.spec.luau b/test/Spec/Graph/evaluate.spec.luau
index 9d53aaf15..112fd5849 100644
--- a/test/Spec/Graph/evaluate.spec.luau
+++ b/test/Spec/Graph/evaluate.spec.luau
@@ -415,6 +415,7 @@ return function()
local seen = {}
for _, searchTarget in searchNow do
searchTarget.lastChange = -depth
+ searchTarget.lastCompute = -depth
searchTarget.validity = if depth == 0 then "valid" else "invalid"
for dependent in searchTarget.dependentSet do
if seen[dependent] then
diff --git a/test/Util/Graphs.luau b/test/Util/Graphs.luau
index d017a7ab8..7faedf390 100644
--- a/test/Util/Graphs.luau
+++ b/test/Util/Graphs.luau
@@ -533,6 +533,7 @@ function Graphs.make(
dependencySet = {},
dependentSet = {},
lastChange = nil,
+ lastCompute = nil,
timeliness = "lazy" :: "lazy",
validity = "valid" :: "valid",
_evaluate = function()