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?