Skip to content

Commit

Permalink
fix(notes): Fixed note updates not working
Browse files Browse the repository at this point in the history
  • Loading branch information
scottbenton committed Aug 2, 2024
1 parent 051c83e commit c1d0de7
Showing 1 changed file with 16 additions and 24 deletions.
40 changes: 16 additions & 24 deletions src/components/features/charactersAndCampaigns/Notes/Notes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,25 @@ export function Notes(props: NotesProps) {

const saveCallback = useCallback(
(
note: { id: string; source: NoteSource },
unparsedId: string,
notes: Uint8Array,
isBeaconRequest?: boolean,
title?: string
) =>
onSave
? onSave(
note.source,
campaignId,
characterId,
note.id,
title ?? "Note",
notes,
isBeaconRequest
)
: new Promise<void>((res) => res()),
) => {
const note = parseId(unparsedId);

return onSave(
note.source,
campaignId,
characterId,
note.id,
title ?? "Note",
notes,
isBeaconRequest
);
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[]
[campaignId, characterId]
);

const roomPrefix =
Expand Down Expand Up @@ -137,16 +138,7 @@ export function Notes(props: NotesProps) {
id={constructId(selectedNote.source, selectedNote.id)}
initialValue={selectedNoteContent ?? undefined}
showTitle
onSave={(unparsedId, notes, isBeaconRequest, title) => {
const { source, id } = parseId(unparsedId);

return saveCallback(
{ source, id },
notes,
isBeaconRequest,
title
);
}}
onSave={saveCallback}
onDelete={(unparsedId) => {
const id = parseId(unparsedId);
onDelete(id);
Expand Down

0 comments on commit c1d0de7

Please sign in to comment.