Fusion icon indicating copy to clipboard operation
Fusion copied to clipboard

`updateAll` terminates updates falsely due to false-positive un-updated dependencies

Open dphfox opened this issue 2 years ago • 2 comments

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

dphfox avatar Apr 22 '22 04:04 dphfox

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.

dphfox avatar Apr 22 '22 04:04 dphfox

Probably related, but while tracing the activity of updateAll I found some nonsensical double-updates occuring - could be stemming from one underlying issue:

image

dphfox avatar Apr 22 '22 04:04 dphfox

Solved by #191

dphfox avatar Feb 01 '23 01:02 dphfox