Skip to content

Commit

Permalink
Merge pull request #3374 from tloncorp/po/land-1731-fix-editing-repli…
Browse files Browse the repository at this point in the history
…es-in-notebook-and-gallery

edit: fix issue with editing replies in notebooks and galleries
  • Loading branch information
patosullivan authored Mar 27, 2024
2 parents 823db5b + e91406a commit 21a8361
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions apps/tlon-web/src/replies/ReplyMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import DoubleCaretRightIcon from '@/components/icons/DoubleCaretRightIcon';
import { JSONToInlines, diaryMixedToJSON } from '@/logic/tiptap';
import useLongPress from '@/logic/useLongPress';
import { useIsMobile } from '@/logic/useMedia';
import { useIsDmOrMultiDm } from '@/logic/utils';
import { nestToFlag, useIsDmOrMultiDm, whomIsNest } from '@/logic/utils';
import {
useEditReplyMutation,
useIsEdited,
Expand Down Expand Up @@ -125,6 +125,9 @@ const ReplyMessage = React.memo<
}: ReplyMessageProps,
ref
) => {
// we pass `whom` as a channel flag for chat, nest for diary/heap
// because we use flags in unreads
const nest = whomIsNest(whom) ? whom : `chat/${whom}`;
const [searchParms, setSearchParams] = useSearchParams();
const isEditing = searchParms.get('editReply') === reply.seal.id;
const isEdited = useIsEdited(reply);
Expand Down Expand Up @@ -285,7 +288,7 @@ const ReplyMessage = React.memo<
}

editReply({
nest: `chat/${whom}`,
nest,
postId: seal['parent-id'],
replyId: seal.id,
memo: {
Expand All @@ -297,7 +300,7 @@ const ReplyMessage = React.memo<

setSearchParams({}, { replace: true });
},
[editReply, whom, seal, memo, setSearchParams]
[editReply, nest, seal, memo, setSearchParams]
);

const messageEditor = useMessageEditor({
Expand Down

0 comments on commit 21a8361

Please sign in to comment.