ios 시뮬레이터로 돌려봤을 때, xcode에 에러 로그가 찍혔고 최종 위치가 badgeProvider인 것으로 나타남.
2023-12-18 19:59:40.868559+0900 [2059:272957] [javascript] ApiUnauthorizedError: [401] unauthorized_api_error
This error is located at:
in BadgeProvider (created by App)
...
...
...
BadgeProvider
와 연관되어있는 API 중에 14일 이후 변경점이 생긴 관련 코드들을 파악BadgeProvider
에서 임포트하고 있는 API관련 훅은 아래와 같았다.GET
유저정보 조회
GET
성향테스트 결과 조회
GET
평가카드 조회
GET
AB테스트 조회
GET
feature flag 조회
이 중, 3번의 경우 유저의 state 상태가 active / review / dormant 일 경우에만 패칭하도록 되어있어 Charles에도 찍히지 않고 있었고 가장 최근에 관련된 변경사항이 많은 API가 4, 5번과 관련된 hook이어서 해당 훅의 변경사항을 확인해보았다.
BEFORE
const query = useQuery(
QUERY_KEY,
async () => {
try {
const response = await request();
return response;
} catch {
return null;
}
},
{
suspense: true,
},
);
AFTER
const useConfigurationBaseQuery = ( _options ) => {
return useQuery({
queryKey: QUERY_KEY,
queryFn: request,
enabled: Boolean(hasToken),
..._options,
});
};
const query = useConfigurationBaseQuery({
suspense: true,
select: () => { ... }
});
...
변경 전, 후 모두 쿼리의 suspense가 true
인데, suspense가 true
일 경우 useErrorBoundary
옵션이 자동으로 true
로 세팅된다.
💡 When using suspense mode,
status
states anderror
objects are not needed and are then replaced by usage of theReact.Suspense
component (including the use of thefallback
prop and React error boundaries for catching errors). Please read the Resetting Error Boundaries and look at the Suspense Example for more information on how to set up suspense mode.
In addition to queries behaving differently in suspense mode, mutations also behave a bit differently. By default, instead of supplying theerror
variable when a mutation fails, it will be thrown during the next render of the component it's used in and propagate to the nearest error boundary, similar to query errors. If you wish to disable this, you can set theuseErrorBoundary
option tofalse
. If you wish that errors are not thrown at all, you can set thethrowOnError
option tofalse
as well!
→ suspense 기능이 활성화 되어 있었고 이로 인해 useErrorBoundary 또한 활성화 된 상태였으나, errorBoundary를 설정하지 않아 상위 컴포넌트로 핸들링되지 않은 에러가 전파되어 운영 환경에서 앱이 종료되었음.
ture
였으나 error를 throw하지 않고 있었다.