Clear map actions when map changes
This commit is contained in:
parent
57e64e132b
commit
002a52674b
@ -336,11 +336,14 @@ function NetworkedMapAndTokens({ session }) {
|
|||||||
updateActionIndex(1, "fogDrawActionIndex", "fogDrawActions", "fogShapes");
|
updateActionIndex(1, "fogDrawActionIndex", "fogDrawActions", "fogShapes");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If map changes clear map actions
|
||||||
|
const previousMapIdRef = useRef();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!currentMapState) {
|
if (currentMap && currentMap.id !== previousMapIdRef.current) {
|
||||||
setMapActions(defaultMapActions);
|
setMapActions(defaultMapActions);
|
||||||
|
previousMapIdRef.current = currentMap.id;
|
||||||
}
|
}
|
||||||
}, [currentMapState]);
|
}, [currentMap]);
|
||||||
|
|
||||||
function handleNoteChange(note) {
|
function handleNoteChange(note) {
|
||||||
setCurrentMapState((prevMapState) => ({
|
setCurrentMapState((prevMapState) => ({
|
||||||
|
Loading…
Reference in New Issue
Block a user