Clear map actions when map changes

This commit is contained in:
Mitchell McCaffrey 2021-02-11 23:09:00 +11:00
parent 57e64e132b
commit 002a52674b

View File

@ -336,11 +336,14 @@ function NetworkedMapAndTokens({ session }) {
updateActionIndex(1, "fogDrawActionIndex", "fogDrawActions", "fogShapes");
}
// If map changes clear map actions
const previousMapIdRef = useRef();
useEffect(() => {
if (!currentMapState) {
if (currentMap && currentMap.id !== previousMapIdRef.current) {
setMapActions(defaultMapActions);
previousMapIdRef.current = currentMap.id;
}
}, [currentMapState]);
}, [currentMap]);
function handleNoteChange(note) {
setCurrentMapState((prevMapState) => ({