redux-toolkit icon indicating copy to clipboard operation
redux-toolkit copied to clipboard

Am I missunderstanding RTK Query Cache feature?

Open atalayio opened this issue 8 months ago • 2 comments

When I make a request in Lazy Query, I cache the returned result and try to use the data in the cache even if the page changes. I make a request, the result is returned, and when I change the page, it appears as data: undefined, even though I set the preferCacheValu to true. What am I doing wrong? My code is given below;

  const [
    getCachedStockDocumentList,
    { data: stockDocumentListData}
  ] = mrpApi.endpoints.getApiStockDocumentStockDocumentList.useLazyQuery();

  console.log(stockDocumentListData)

//request
onClick={async () => await getCachedStockDocumentList({}, true)}

atalayio avatar Jun 13 '24 12:06 atalayio