Fix custom token loading for players
This commit is contained in:
parent
9d9fd5b753
commit
7d1cff7358
@ -1,4 +1,5 @@
|
||||
import { useEffect, useState, useRef, useCallback } from "react";
|
||||
import cloneDeep from "lodash.clonedeep";
|
||||
|
||||
import useDebounce from "./useDebounce";
|
||||
import { diff, applyChanges } from "../helpers/diff";
|
||||
@ -70,7 +71,7 @@ function useNetworkedState(
|
||||
}
|
||||
dirtyRef.current = false;
|
||||
forceUpdateRef.current = false;
|
||||
lastSyncedStateRef.current = debouncedState;
|
||||
lastSyncedStateRef.current = cloneDeep(debouncedState);
|
||||
}
|
||||
}, [
|
||||
session.socket,
|
||||
|
@ -91,15 +91,15 @@ function NetworkedMapAndTokens({ session }) {
|
||||
function addAssetsIfNeeded(assets) {
|
||||
setAssetManifest((prevManifest) => {
|
||||
if (prevManifest?.assets) {
|
||||
let newManifset = { ...prevManifest };
|
||||
let newAssets = { ...prevManifest.assets };
|
||||
for (let asset of assets) {
|
||||
const id = asset.id;
|
||||
const exists = id in prevManifest.assets;
|
||||
const exists = id in newAssets;
|
||||
if (!exists) {
|
||||
newManifset[id] = asset;
|
||||
newAssets[id] = asset;
|
||||
}
|
||||
}
|
||||
return newManifset;
|
||||
return { ...prevManifest, assets: newAssets };
|
||||
}
|
||||
return prevManifest;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user