Skip to content

알람 오류 해결 + Tanstack-Query Devtools 설치#34

Open
jihostudy wants to merge 5 commits intodevfrom
feat/alarm-error
Open

알람 오류 해결 + Tanstack-Query Devtools 설치#34
jihostudy wants to merge 5 commits intodevfrom
feat/alarm-error

Conversation

@jihostudy
Copy link
Copy Markdown
Member

@jihostudy jihostudy commented Apr 6, 2025

1. 오류 해결

알람 확인 요청이 로그인되지 않은 상태에서도 계속 보내지는 오류

image

오류원인

로그인하지 않은 상태에서는 초기값이 accessToken = "" 이며, 이는 enabled 설정인 accessToken !== undefined 에 걸리지 않음.

해결방법

초기값 accessToken ='' 에 따라, enabled 설정을 동기화시킴.

const { data: AlarmData, isPending: isPendingAlarmData } = useQuery({
    queryKey: QUERY_KEYS.MYPAGE.ALARM_LIST,
    queryFn: async () => {
      const data = await SettlementAlarmList({ accessToken })

      return data.data as AlarmDTO[]
    },
    enabled: accessToken !== '' /** 로그인되어 있을 경우만 */, ✅ undefined -> '' 로 변경됨
  })

2. Tanstack-Query DevTools를 설치했습니다.

공식지원하는 도구로, 캐싱값의 상태를 우하단 아이콘을 눌러서 확인할 수 있습니다!

image image

@jihostudy jihostudy added bug 오류 해결 feature 새로운 기능 및 페이지 labels Apr 6, 2025
@jihostudy jihostudy requested review from Jinviz and S2UZY April 6, 2025 11:59
@jihostudy jihostudy self-assigned this Apr 6, 2025
기존 cacheTime -> gcTime으로 명칭 변경됨
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 오류 해결 feature 새로운 기능 및 페이지

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant