react-query에는 분명하게 알아둬야 할 default한 사항들이 있다. 모르고 넘어가면 나중에 왜 안 되는지 골치아플 확률이 높으니 분명하게 알아두자.
useQuery
, useInfiniteQuery
의 staleTimeuseQuery
, useInfiniteQuery
등에 의해 관찰되지 않는 데이터는 inactive
라벨이 붙는다.cacheTime
)이 지나면 inactive query는 버려진다.cacheTime
옵션 기본값은 5분
== 1000 * 60 * 5 ms
이다.Query results by default are structurally shared to detect if data has actually changed and if not, the data reference remains unchanged to better help with value stabilization with regards to useMemo and useCallback. If this concept sounds foreign, then don't worry about it! 99.9% of the time you will not need to disable this and it makes your app more performant at zero cost to you.