persistor.purge()

persistor.purge()

https://github.com/rt2zz/redux-persist
redux-persist 정리할 때 purge에 대해서 구체적으로 작성해보겠습니다.

상황

  • 작업하면서 계속 리로딩을 하고 있었는데 reducer에서 값을 넣는 모양을 계속 바꿔주면서 작업하고 있었는데, 갑자기 로딩화면만 계속 나오기 시작

에러 메세지

1
TypeError: In this environment the sources for assign MUST be an object. This error is a performance optimization and not spec compliant

원인

오류가 있는 persist 저장소를 갖고있어서 그럼.

솔루션

https://github.com/rt2zz/redux-persist/issues/536

  1. 루트 폴더에 persist를 작성한 부분 중 const persistor = persistStore(store);를 찾아냅니다.
  2. 해당 코드 밑에 persistor.purge();를 넣고 다시 실행 (purge는 persistStore의 데이터를 전부 날리는 역할을 한다.)
  3. 잘 싱행된다면 해당 코드는 삭제하세요.