Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#247) slow 3G 환경에서도 #247이 여전히 재현되는 버그 수정 #263

Merged
merged 1 commit into from
Apr 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { Link, useHistory, useLocation } from 'react-router-dom';
import { Link, useLocation } from 'react-router-dom';
import FavoriteIcon from '@material-ui/icons/Favorite';
import FavoriteBorderIcon from '@material-ui/icons/FavoriteBorder';
import CreateIcon from '@material-ui/icons/Create';
Expand All @@ -27,8 +27,6 @@ import NewResponse from './new-response/NewResponse';
export default function QuestionItem({ questionObj, onSubmit }) {
const dispatch = useDispatch();
const location = useLocation();
const history = useHistory();
const isQuestionList = location.pathname === '/questions';
const isAnon =
location?.pathname.includes('anonymous') ||
location?.search?.includes('anonymous=True');
Expand Down Expand Up @@ -84,8 +82,6 @@ export default function QuestionItem({ questionObj, onSubmit }) {
const onSubmitHandler = () => {
onSubmit?.();
setIsWriting(false);

if (isQuestionList) history.push('/home');
};

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,19 @@ export default function ShareSettings({
);
history.push(location.pathname.slice(0, -4));
} else {
resetContent?.();

await dispatch(
createPost({
...postObj,
...shareState
})
);
resetContent?.();

// FIXME: feed는 캐싱하면 의도치 않게 stale한 응답을 보여줄 수 있음
refetchFriendPostList({ refetchPage: () => true });

if (location.pathname === '/questions') history.push('/home');
Comment on lines +69 to +72
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어차피 home으로 redirect 시켜주고 refetch를 할 거면
useInfiniteFriendPostList 안에서
refetchOnMount: true
option을 주는 건 어떨까요?

feed는 말씀대루 특성상 캐싱이 되는 것을 최소화하는게 맞는 것 같고,
고러면 refetchFriendPostList도 /home이 아닌 곳에서 굳이 할 필요 없지 않나 싶어서요!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네! 이건 오늘 얘기한 scroll 유지 기능 스펙아웃 검토하면서 같이 검토해보기로 해요~~
캐시할 필요가 없어지만 지나님 말씀대로 refetchOnMount되도 좋을 것 같습니다!

}

onSubmit?.();
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/components/friend-feed/FriendFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const FriendFeed = () => {
fetchNextPage,
isFetchingNextPage,
isFetching,
isLoading,
refetch: refetchFriendPostList
} = useInfiniteFriendPostList();

Expand Down Expand Up @@ -71,7 +70,7 @@ const FriendFeed = () => {
<PostList
posts={friendPosts}
isAppending={isFetchingNextPage}
isLoading={isLoading}
isLoading={isFetching}
/>
)}
<ScrollTopButton callback={refetchFriendPostList} />
Expand Down