Is that a race condition?

local loadedAssets, setLoadedAssets = hooks.useState({})
local function addLoadedAsset(asset, _)
	local updatedLoadedAssets = table.clone(loadedAssets)
	table.insert(updatedLoadedAssets, asset)
	setLoadedAssets(updatedLoadedAssets)
end
local assetsToLoad = getAssetsToLoad()
ContentProvider:PreloadAsync(assetsToLoad, addLoadedAsset)

Can race conditions occur in this code? PreloadAsync is asynchronous as its name states.
If race conditions can occur in this code, how can this issue be solved?

2 Likes

Nevermind, question got answered elsewhere. It’s not!

2 Likes