Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Commit

Permalink
Bugfix for deleting a comment (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
sharplessHQ authored Jun 23, 2023
1 parent 354ddf1 commit b4a7fb7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type CommentGroupProps = ComponentProps<'div'> & {
hideCommands?: boolean;
expandedCommandIDs?: string[];
removeExpandedCommandID?: (commandId: string) => void;
refetchComments?: () => void;
};
export const CommentGroup = observer<CommentGroupProps>(
({
Expand All @@ -26,6 +27,7 @@ export const CommentGroup = observer<CommentGroupProps>(
hideCommands,
expandedCommandIDs = [],
removeExpandedCommandID,
refetchComments,
...props
}) => {
const store = useStore();
Expand Down Expand Up @@ -59,6 +61,7 @@ export const CommentGroup = observer<CommentGroupProps>(
annotation={annotation?.maybeCurrent}
commandGroup={commandGroup}
isFullList
refetchComments={refetchComments}
/>
))}
{newComment === commandGroup?.id && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const Comments = observer<CommentsProps>(({ sort }) => {
},
});

const { data: commandGroupIdData } = useQuery(
const { data: commandGroupIdData, refetch: refetchComments } = useQuery(
[
'commandGroups',
store.campaign?.id,
Expand Down Expand Up @@ -186,6 +186,7 @@ export const Comments = observer<CommentsProps>(({ sort }) => {
newComment={state.newComment}
expandedCommandIDs={state.expandedCommandIDs}
removeExpandedCommandID={state.removeExpandedCommandID}
refetchComments={refetchComments}
/>
))
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type CommentBoxProps = ComponentProps<'div'> & {
reply?: () => void;
isAddingCommandToComment?: boolean;
isFullList?: boolean;
refetchComments?: () => void;
};

export const CommentBox = observer<CommentBoxProps>(
Expand All @@ -55,6 +56,7 @@ export const CommentBox = observer<CommentBoxProps>(
popoverRef,
isAddingCommandToComment = false,
isFullList = false,
refetchComments,
...props
}) => {
const store = useStore();
Expand All @@ -67,6 +69,7 @@ export const CommentBox = observer<CommentBoxProps>(
}),
{
onSuccess: (annotationData) => {
refetchComments?.();
state.refetch();
if (annotationData) {
store.graphqlStore.annotations.delete(annotationData.deleteAnnotation.id);
Expand Down

0 comments on commit b4a7fb7

Please sign in to comment.