question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add Additional Information for Redux-Persist

See original GitHub issue

I was working on a project where I implemented RTK with redux-persist following the docs for RTK but I wanted to ‘flush’ storage on user logout which seems to be a fairly common action and it wasn’t immediately apparent how to accomplish this with RTK based on current documentation. Here was the final solution:

import { PURGE } from "redux-persist";

...
extraReducers: (builder) => {
    builder.addCase(PURGE, (state) => {
        customEntityAdapter.removeAll(state);
    });
}

Can I open a PR for this addition to the docs?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
phryneascommented, Jul 7, 2021

Always 😃

0reactions
grumpyTofucommented, Jul 7, 2021

Well at least one thing is certain, RTK is an awesome product!

I would be more than happy to add it to the docs if you would like?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Persist state with Redux Persist using Redux Toolkit in React
Persisting state with Redux Persist. First, we'll add Redux Persist to our app with the following command: $ npm i redux-persist.
Read more >
rt2zz/redux-persist: persist and rehydrate a redux store - GitHub
Redux persist ships with react integration as a convenience. The PersistGate component is the recommended way to delay rendering until persistence is complete....
Read more >
The Definitive Guide to Redux Persist - React Native Coach
Persist your Redux state in between app launches with Redux Persist ... Redux Persist takes your Redux state object and saves it to...
Read more >
How to Persist Your Redux Store - How-To Geek
Redux Persist is a popular library which lets you add persistence to the store. The library will automatically save the store each time...
Read more >
Redux-Persist: How it Works and How to Change the Structure ...
Redux persist is a library allowing to save the redux store in the local storage of your browser. But, using redux-persist and changing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found