Skip to content

initiate with {subscribe: false} resets keepUnusedDataFor #4480

Description

@PepeBotella25

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    RTK-QueryIssues related to Redux-Toolkit-Query

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions