Skip to content

Commit

Permalink
edit: fix issue with editing replies in notebooks and galleries
Browse files Browse the repository at this point in the history
Fixes LAND-1731
  • Loading branch information
patosullivan committed Mar 27, 2024
1 parent 823db5b commit e91406a
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 e91406a

Please sign in to comment.