Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type-safe persistStore() #1085

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

type-safe persistStore() #1085

wants to merge 1 commit into from

Conversation

arzyu
Copy link

@arzyu arzyu commented Sep 7, 2019

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

@javierbustamante
Copy link

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

@rajharshwal92
Copy link

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

@daruj
Copy link

daruj commented Mar 16, 2020

Hey guys, when are u merging this?

@MichelMelhem
Copy link

up

@JuanGilArizon
Copy link

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

@guitoof
Copy link

guitoof commented Apr 3, 2020

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?

@nicoleCamoro
Copy link

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

@ahmadichsan
Copy link

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

@BenoitSerrano
Copy link

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

@artdevgame
Copy link

@rt2zz Is it possible to merge this in please?

@gpawlik
Copy link

gpawlik commented Jun 24, 2020

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

@ease-space
Copy link

Why cannot be merge???

@sunnylqm
Copy link

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

@gpawlik
Copy link

gpawlik commented Jun 25, 2020

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

@ease-space
Copy link

@rt2zz why cannot be merge?

@NoahFiner
Copy link

can we merge? :)

@ronaldruzicka
Copy link

@rt2zz please merge, I need this as well 🙏

@Jonathan0wh
Copy link

any update on when it will be merged?

@mfrey777
Copy link

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

@lawhorkl
Copy link

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

@Jonathan0wh
Copy link

It's still not merged?

@Rocamonde
Copy link

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

@delewis13
Copy link

@arzyu :)

@arzyu
Copy link
Author

arzyu commented Jul 17, 2021

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

@irinrudko
Copy link

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

@malininss
Copy link

please merge this

@anaerobic
Copy link

has conflicts @arzyu are you able to resolve?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.