diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 408ba61f..7ab3c360 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -16,6 +16,7 @@ - Fixed cursor issue on the notes page with mobile Safari - Fixed a performance issue that made switching tabs super slow - Fixed a few crashes that could occur when switching pages after the application updated in the background +- Fixed an issue on the sectors page where saving would cause users to be kicked from the notes box ## 2.2.0 diff --git a/src/components/features/worlds/SectorSection/OpenSector.tsx b/src/components/features/worlds/SectorSection/OpenSector.tsx index e1c389bc..321a31bc 100644 --- a/src/components/features/worlds/SectorSection/OpenSector.tsx +++ b/src/components/features/worlds/SectorSection/OpenSector.tsx @@ -25,6 +25,7 @@ import { NPCItem } from "../NPCSection/NPCItem"; import { DebouncedOracleInput } from "components/shared/DebouncedOracleInput"; import DeleteIcon from "@mui/icons-material/Delete"; import { useConfirm } from "material-ui-confirm"; +import { useCallback } from "react"; interface OpenSectorProps { sectorId: string; @@ -212,6 +213,18 @@ export function OpenSector(props: OpenSectorProps) { (store) => store.worlds.currentWorld.currentWorldNPCs.setOpenNPCId ); + const noteSaveCallback = useCallback( + (sectorId: string, notes: Uint8Array, isBeaconRequest?: boolean) => + updateNotes(sectorId, notes, false, isBeaconRequest), + [updateNotes] + ); + + const gmNoteSaveCallback = useCallback( + (sectorId: string, notes: Uint8Array, isBeaconRequest?: boolean) => + updateNotes(sectorId, notes, true, isBeaconRequest), + [updateNotes] + ); + if (!sector) { return null; } @@ -340,9 +353,7 @@ export function OpenSector(props: OpenSectorProps) { id={sectorId} roomPrefix={`sector-private-${worldId}-`} documentPassword={sectorId} - onSave={(sectorId, notes, isBeaconRequest) => - updateNotes(sectorId, notes, true, isBeaconRequest) - } + onSave={gmNoteSaveCallback} initialValue={gmNotes} /> @@ -359,9 +370,7 @@ export function OpenSector(props: OpenSectorProps) { id={sectorId} roomPrefix={`sector-public-${worldId}-`} documentPassword={sectorId} - onSave={(sectorId, notes, isBeaconRequest) => - updateNotes(sectorId, notes, false, isBeaconRequest) - } + onSave={noteSaveCallback} initialValue={notes} /> diff --git a/src/pages/Home/Licensing.tsx b/src/pages/Home/Licensing.tsx index e697646a..9c22c0cf 100644 --- a/src/pages/Home/Licensing.tsx +++ b/src/pages/Home/Licensing.tsx @@ -19,7 +19,7 @@ export function Licensing() { <> This work is based on{" "} Ironsworn: Starforged, - created by Shawn Tompkin, and licensed for our use under the{" "} + created by Shawn Tomkin, and licensed for our use under the{" "} Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license.