Skip to content

The addition of "keys" in state.api.provided breaks rehydration #5053

@GertSallaerts

Description

@GertSallaerts

From Release 2.7.0

We've restructured the state.api.provided data structure to handle reverse-mapping between tags and cache keys, which drastically improves performance in this case.

I believe this is what is breaking rehydration. I've created a codesandbox: https://codesandbox.io/p/devbox/rtk-query-persist-pending-forked-h93g47?workspaceId=ws_CAJAxLFH2LyYTzcwzts226

If you refresh the example once or twice, you'll see an error about cacheKeys not being iterable. I think I traced it back to this line:

for (const [id, cacheKeys] of Object.entries(incomingTags)) {

That needs to go one level deeper into the state structure unless I'm mistaken.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions