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

initiate with {subscribe: false} resets keepUnusedDataFor

Open PepeBotella25 opened this issue 1 year ago • 0 comments

Calling initiate with {subscribe: false} seems to be resetting keepUnusedDataFor and cached data never expires

// default keepUnusedDataFor is 60s

// Does the request and caches the data as expected
store.dispatch(api.endpoints.myEndpoint.initiate({}, { subscribe: false }))

// Does not trigger a request and uses cached data as expected
setTimeout(() => store.dispatch(api.endpoints.myEndpoint.initiate({}, { subscribe: false })), 30 * 1000);

// Does not trigger a request and uses cached data which should be expired
setTimeout(() => store.dispatch(api.endpoints.myEndpoint.initiate({}, { subscribe: false })), 61 * 1000);

PepeBotella25 avatar Jun 24 '24 13:06 PepeBotella25