Fixed bug with map setting changes not being synced over to players
This commit is contained in:
parent
6aa1f28c96
commit
8f9027c69f
@ -105,13 +105,12 @@ export function MapDataProvider({ children }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function updateMap(id, update) {
|
async function updateMap(id, update) {
|
||||||
const change = { ...update, lastModified: Date.now() };
|
await database.table("maps").update(id, update);
|
||||||
await database.table("maps").update(id, change);
|
|
||||||
setMaps((prevMaps) => {
|
setMaps((prevMaps) => {
|
||||||
const newMaps = [...prevMaps];
|
const newMaps = [...prevMaps];
|
||||||
const i = newMaps.findIndex((map) => map.id === id);
|
const i = newMaps.findIndex((map) => map.id === id);
|
||||||
if (i > -1) {
|
if (i > -1) {
|
||||||
newMaps[i] = { ...newMaps[i], ...change };
|
newMaps[i] = { ...newMaps[i], ...update };
|
||||||
}
|
}
|
||||||
return newMaps;
|
return newMaps;
|
||||||
});
|
});
|
||||||
|
@ -216,7 +216,11 @@ function SelectMapModal({
|
|||||||
const [mapStateSettingChanges, setMapStateSettingChanges] = useState({});
|
const [mapStateSettingChanges, setMapStateSettingChanges] = useState({});
|
||||||
|
|
||||||
function handleMapSettingsChange(key, value) {
|
function handleMapSettingsChange(key, value) {
|
||||||
setMapSettingChanges((prevChanges) => ({ ...prevChanges, [key]: value }));
|
setMapSettingChanges((prevChanges) => ({
|
||||||
|
...prevChanges,
|
||||||
|
[key]: value,
|
||||||
|
lastModified: Date.now(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleMapStateSettingsChange(key, value) {
|
function handleMapStateSettingsChange(key, value) {
|
||||||
|
Loading…
Reference in New Issue
Block a user