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

type-safe persistStore()

Open arzyu opened this issue 5 years ago • 27 comments

After this patch, we can persistStore(store) without any type errors when using store: Store<RootState, RootAction>.

Here is my usage scenario:

import React, { StatelessComponent } from "react";
import { Provider } from "react-redux";
import { Route } from "react-router-dom";
import { Store } from "redux";
import { persistStore } from "redux-persist";
import { PersistGate } from "redux-persist/integration/react";

import { Router } from "./Router";
import { RootState, RootAction } from "./store";

interface Props {
  store: Store<RootState, RootAction>;
  app: StatelessComponent;
}

export const Root: StatelessComponent<Props> = ({ store, app }) => (
  <Provider store={store}>
    <PersistGate persistor={persistStore(store)}>
      <Router>
        <Route path="/:path?" component={app} />
      </Router>
    </PersistGate>
  </Provider>
);

arzyu avatar Sep 07 '19 17:09 arzyu

Someone knows what happen with the PR's in this repo?

javierbustamante avatar Feb 26 '20 12:02 javierbustamante

Kindly merge this Branch. This PR can solve type error related to store.

rajharshwal92 avatar Mar 14 '20 04:03 rajharshwal92

Hey guys, when are u merging this?

daruj avatar Mar 16 '20 04:03 daruj

up

MichelMelhem avatar Mar 16 '20 16:03 MichelMelhem

I think ive solved it just adding "PersistPartial" type in the createStore function: const store = createStore<IRootState & PersistPartial, any, any, any>( persistedReducer ); Hope it helps somebody

JuanGilArizon avatar Mar 21 '20 19:03 JuanGilArizon

Hi there, this looks like a decent solution to me! Thank you very much, just patched it in my project 🙏 Do you guys think it can be merged?

guitoof avatar Apr 03 '20 22:04 guitoof

This looks like it could fix my problem. Is this gonna get merged?

nicoleCamoro avatar Apr 21 '20 11:04 nicoleCamoro

Hello, any update for this PR? Seems like a solution for type error issue related to store.

ahmadichsan avatar Apr 24 '20 06:04 ahmadichsan

Hello ! I patched it into my project and it works :) Could you merge it?

BenoitSerrano avatar Apr 28 '20 09:04 BenoitSerrano

@rt2zz Is it possible to merge this in please?

artdevgame avatar Jun 22 '20 09:06 artdevgame

@sunnylqm Is there any reason it cannot be merged yet?

gpawlik avatar Jun 24 '20 08:06 gpawlik

Why cannot be merge???

ease-space avatar Jun 24 '20 18:06 ease-space

I do not have the permission. I made an approval to try to remind those who have permissions to merge. (Yes, anyone can approve)

sunnylqm avatar Jun 25 '20 00:06 sunnylqm

Thanks for the message @sunnylqm . I guess the question should be directed rather to @rt2zz then.

gpawlik avatar Jun 25 '20 09:06 gpawlik

@rt2zz why cannot be merge?

ease-space avatar Jul 01 '20 06:07 ease-space

can we merge? :)

NoahFiner avatar Jul 02 '20 03:07 NoahFiner

@rt2zz please merge, I need this as well 🙏

ronaldruzicka avatar Jul 15 '20 14:07 ronaldruzicka

any update on when it will be merged?

Jonathan0wh avatar Sep 02 '20 10:09 Jonathan0wh

Is there any news on the merge of this PR, would be very much appreciated.

mfrey777 avatar Oct 26 '20 15:10 mfrey777

waiting over a year for this to get merged, this is kind of ridiculous

lawhorkl avatar Dec 14 '20 20:12 lawhorkl

It's still not merged?

Jonathan0wh avatar Jan 21 '21 05:01 Jonathan0wh

Kindly merge this and include it in a new release as soon as possible.

Rocamonde avatar Jun 16 '21 16:06 Rocamonde

@arzyu :)

delewis13 avatar Jul 17 '21 06:07 delewis13

I don’t have permission to merge code, hope the maintainer will continue to be active.

arzyu avatar Jul 17 '21 07:07 arzyu

I love it! Thank you so much! It's the only source where I could've found this.

irinrudko avatar Mar 03 '22 20:03 irinrudko

please merge this

malininss avatar Jun 07 '22 11:06 malininss

has conflicts @arzyu are you able to resolve?

anaerobic avatar Oct 01 '23 04:10 anaerobic