Skip to content

Commit

Permalink
fix: toast/viewer에 key값 추가 (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinoov committed Jul 23, 2024
1 parent 3480547 commit 3054a4f
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const ActivityDetail = ({ loading, activity, activityMembers, activityMemberIDs,
<PlanContainer>
<h2 className="title">계획서</h2>
<PlanContents>
<Viewer initialValue={activity.description} />
<Viewer initialValue={activity.description} key={activity.description} />
</PlanContents>
<FileContainerTitle>첨부된 파일 목록</FileContainerTitle>
<FileContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const Session = ({ session, memberInfo, activityID, attendance, host }) => {
<Date>{date}</Date>
<Date>({hour}시간 진행)</Date>
<Description>
<Viewer initialValue={description} />
<Viewer initialValue={description} key={description} />
</Description>
{isLogin && (
<>
Expand Down
14 changes: 2 additions & 12 deletions apps/web-client/src/components/board/BoardJobWriteSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { Link, useHistory } from 'react-router-dom';
import { stringify } from 'qs';
import { createStyles } from 'antd-style';
import { UploadOutlined } from '@ant-design/icons';
import { useQueryClient } from '@tanstack/react-query';
import { ApiError, CustomApi, PostControllerService, PostCreateRequest, queryKey, useAppMutation, useAppQuery } from '~/lib/api-v2';
import { Block, WhiteBlock } from '~/styles/common/Block.styles';
import { MENU } from '~/constants/menus';
Expand Down Expand Up @@ -58,7 +57,6 @@ export default function BoardJobWriteSection({ postId }: { postId: number }) {
const { styles } = useStyles();
const message = useMessage();
const history = useHistory();
const queryClient = useQueryClient();

const editorRef = useRef<Editor | null>(null);
const form = useForm<z.infer<typeof schema>>({
Expand Down Expand Up @@ -166,11 +164,7 @@ export default function BoardJobWriteSection({ postId }: { postId: number }) {
{
onSuccess() {
message.success('글이 수정되었습니다.');
queryClient
.invalidateQueries({
queryKey: queryKey.post.post(postId),
})
.then(() => history.push(`/${MENU.BOARD}/${postId}`));
history.push(`/${MENU.BOARD}/${postId}`);
},
},
);
Expand All @@ -195,11 +189,7 @@ export default function BoardJobWriteSection({ postId }: { postId: number }) {
{
onSuccess() {
message.success('글이 작성되었습니다.');
queryClient
.invalidateQueries({
queryKey: queryKey.post.all('JOB', 0),
})
.then(() => history.push(`/${MENU.BOARD}?${stringify({ boardType: 'JOB' })}`));
history.push(`/${MENU.BOARD}?${stringify({ boardType: 'JOB' })}`);
},
},
);
Expand Down
13 changes: 2 additions & 11 deletions apps/web-client/src/components/board/BoardNormalWriteSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export default function BoardNormalWriteSection({ boardType, postId }: { boardTy
const history = useHistory();
const message = useMessage();
const loginId = useAppSelector((state) => state.auth.user.memberId);
const queryClient = useQueryClient();

const editorRef = useRef<Editor | null>(null);

Expand Down Expand Up @@ -120,11 +119,7 @@ export default function BoardNormalWriteSection({ boardType, postId }: { boardTy
{
onSuccess() {
message.success('글이 수정되었습니다.');
queryClient
.invalidateQueries({
queryKey: queryKey.post.post(postId),
})
.then(() => history.push(`/${MENU.BOARD}/${postId}`));
history.push(`/${MENU.BOARD}/${postId}`);
},
},
);
Expand All @@ -145,11 +140,7 @@ export default function BoardNormalWriteSection({ boardType, postId }: { boardTy
{
onSuccess() {
message.success('글이 작성되었습니다.');
queryClient
.invalidateQueries({
queryKey: queryKey.post.all(boardType, 0),
})
.then(() => history.push(`/${MENU.BOARD}?${stringify({ boardType })}`));
history.push(`/${MENU.BOARD}?${stringify({ boardType })}`);
},
},
);
Expand Down
2 changes: 1 addition & 1 deletion apps/web-client/src/components/intro/IntroPoolc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const Intro = () => {
<WhiteNarrowBlock>
<Title>PoolC 소개</Title>
<Body>
<Viewer initialValue={info.introduction ?? ''} />
<Viewer initialValue={info.introduction ?? ''} key={info.introduction ?? ''} />
</Body>
<Title>동아리방 위치</Title>
<StyledImage src={getFileUrl(info.locationUrl)} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const ProjectDetail = ({ project, member }) => {
<IntroductionContainer>
<Introduction>
<BodyContainer className="here">
<Viewer initialValue={body} />
<Viewer initialValue={body} key={body} />
</BodyContainer>
</Introduction>
</IntroductionContainer>
Expand Down
8 changes: 2 additions & 6 deletions apps/web-client/src/pages/board/BoardDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,7 @@ export default function BoardDetailPage() {
message.success('삭제되었습니다.');
// TODO: assert 이용해서 수정
const boardType = post!.boardType!;
queryClient
.invalidateQueries({
queryKey: queryKey.post.all(boardType, 0),
})
.then(() => history.push(`/${MENU.BOARD}?${stringify({ boardType })}`));
history.push(`/${MENU.BOARD}?${stringify({ boardType })}`);
},
},
);
Expand Down Expand Up @@ -311,7 +307,7 @@ export default function BoardDetailPage() {
<Typography.Title level={2}>{post.title}</Typography.Title>
)}
<div className={styles.content}>
<Viewer initialValue={post.body} />
<Viewer initialValue={post.body} key={post.body} />
</div>
{post.fileList && post.fileList.length > 0 && (
<div className={styles.fileListBox}>
Expand Down

0 comments on commit 3054a4f

Please sign in to comment.