Fusion
Fusion copied to clipboard
`updateAll` terminates updates falsely due to false-positive un-updated dependencies
Need to investigate this later, and figure out a reliable repro, but I encounter a bug sometimes where my state objects don't update even after a dependency has changed.
The issue was resolved by bypassing this if
check, which makes me think that this is something to do with how dependencies are checked in this loop:
-- add the dependents of the member for processing
-- optimisation: if nothing changed, then we don't need to add these
-- dependents, because they don't need processing.
-- FIXME: Typed Luau doesn't understand this type narrowing yet
if didChange and (member :: any).dependentSet ~= nil then
local member = member :: PubTypes.Dependent & PubTypes.Dependency
for dependent in pairs(member.dependentSet) do
-- don't add dependents that have un-updated dependencies
local allDependenciesUpdated = true
for dependentDependency in pairs(dependent.dependencySet) do
-- HACK: keys of needsUpdateSet must be Dependents, so
-- since we want to ignore non-Dependents, we just type
-- cast here regardless of safety
if needsUpdateSet[dependentDependency :: any] then
allDependenciesUpdated = false
break
end
end
-- the bypass:
if allDependenciesUpdated or true then
processNextSize += 1
processNext[processNextSize] = dependent
processingDone = false
end
end
end
Since we're going to be reworking this code soon to support indicating where updates come from for a given object, it might just be worth throwing away this code.
Probably related, but while tracing the activity of updateAll
I found some nonsensical double-updates occuring - could be stemming from one underlying issue:
Solved by #191