GNU-CS / catlas-frontend

Unofficial frontend source code of CATLAS community.
GNU Affero General Public License v3.0
0 stars 0 forks source link

Redux Store 갱신 '이전'의 값에 따라 요소가 보여지는 오류 #39

Open hatchling13 opened 3 years ago

hatchling13 commented 3 years ago

개요

Redux Store가 갱신되기 전의 값에 따라 웹사이트의 오류 문구 등이 적용되는 오류를 해결한다.

문제 상황

Reduxdispatch를 통해 비동기적으로 Store의 값을 변경한다. 이 때, await 키워드를 통해 Store가 갱신되기를 기다렸다가 바뀐 값(이 경우 errorCode)에 따라 오류 문구를 보여준다. 그러나 errorCode가 원하는 때에 갱신되지 않아 이전 값에 따라 결과 처리가 진행된다.

생각할 수 있는 원인은 다음과 같다:

  1. async/await의 사용이 미숙하여 잘못 사용하였다.
  2. useSelector의 갱신 시점이 올바르지 않다.