Skip to content

Commit b5ea8ad

Browse files
committed
chore: Add isSkip state for skipping query when remove series
1 parent a86f21c commit b5ea8ad

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/containers/velog/SeriesPosts.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,23 @@ const SeriesPosts: React.FC<SeriesPostsProps> = ({ username, urlSlug }) => {
4040
const user = useUser();
4141
const isOwnSeries = user && user.username === username;
4242
const [askRemove, setAskRemove] = useState(false);
43+
const [isSkip, setIsSkip] = useState(false);
4344
const [removeSeries] = useMutation(REMOVE_SERIES);
4445
const { data } = useQuery<GetSeriesResponse>(GET_SERIES, {
4546
variables: {
4647
username,
4748
url_slug: urlSlug,
4849
},
4950
fetchPolicy: 'cache-and-network',
51+
skip: isSkip,
5052
});
5153

5254
const client = useApolloClient();
5355

5456
const onAskRemove = () => setAskRemove(true);
5557
const onConfirmRemove = async () => {
5658
try {
59+
setIsSkip(true);
5760
await removeSeries({
5861
variables: {
5962
id: data?.series?.id,
@@ -64,7 +67,10 @@ const SeriesPosts: React.FC<SeriesPostsProps> = ({ username, urlSlug }) => {
6467

6568
const redirect = `${process.env
6669
.REACT_APP_CLIENT_V3_HOST!}/@${username}/series`;
67-
window.location.href = redirect;
70+
71+
setTimeout(() => {
72+
window.location.href = redirect;
73+
}, 100);
6874
} catch (e) {
6975
toast.error('시리즈 삭제 실패');
7076
}

0 commit comments

Comments
 (0)