From 4a19785e9c084cd2ebcd4b7361e93afd1ef0e4cb Mon Sep 17 00:00:00 2001 From: cdm1263 Date: Fri, 19 Jul 2024 11:59:51 +0000 Subject: [PATCH] Merge pull request #132 from side-project-pokehub/dev MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 옵티미스틱 업데이트 수정 --- src/components/detail/LikePokemon.tsx | 4 +++- src/components/dex/PokemonDex.module.scss | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/detail/LikePokemon.tsx b/src/components/detail/LikePokemon.tsx index 66c50ca..45e7f75 100644 --- a/src/components/detail/LikePokemon.tsx +++ b/src/components/detail/LikePokemon.tsx @@ -37,7 +37,10 @@ const LikePokemon = ({ pokemonId, isLoading }: LikePokemonProps) => { if (!user?.uid) { return alert('로그인이 필요합니다.'); } + + setIsLiked((prev) => !prev); setAnimate(true); + try { const docSnap = await getDocument(`/likes/${user.uid}`); let likes = []; @@ -61,7 +64,6 @@ const LikePokemon = ({ pokemonId, isLoading }: LikePokemonProps) => { }); } catch (error) { console.log(error); - } finally { setIsLiked((prev) => !prev); } }; diff --git a/src/components/dex/PokemonDex.module.scss b/src/components/dex/PokemonDex.module.scss index 418536d..ade0468 100644 --- a/src/components/dex/PokemonDex.module.scss +++ b/src/components/dex/PokemonDex.module.scss @@ -13,8 +13,8 @@ } .pokemon_list_element { - width: 100%; - height: 315px; + /* width: 100%; + height: 315px; */ display: flex; position: relative; align-items: center;