trufflesuite / drizzle

Reactive Ethereum dapp UI suite
906 stars 238 forks source link

Redux Store w/ initial state integrated to Drizzle's internal store #98

Open fodisi opened 3 years ago

fodisi commented 3 years ago

I'm working to integrate an existing Drizzle app into another existing app - I'll name it "the Main app" - that also has it's own redux store. The Drizzle app will become a "component/submodule" of the Main app. The existing Drizzle app already uses drizzle's internal store, with no initial state set. The Main app, already has its own store, and has a some initialization to the store's initial state (passing the "initialState" to redux's "createStore" method). I'd like to be able to use a single store, integrating Main app's store w/ Drizzle app by using Drizzle's "generateStore" method.

However, checking this method on generateStore.js it doesn't seem to accept an external state (i.e., appState) that could be merged w/ drizzle's "initialContractState" (as it does to appReducers, appSagas, appMiddlewares), making it difficult to initialize the app state external to drizzle. Would you have any recommendations on how to accomplish the scenario above?

Is submitting a PR to accept an "appState" in the drizzle's "generateStore" method an option or something that you think would be worth doing?

Thank you.

cds-amal commented 3 years ago

@fodisi sure, I think this is worthwhile.

fodisi commented 3 years ago

Great, @cds-amal . I'll work on it and submit a PR soon. Thank you.

fodisi commented 3 years ago

@cds-amal , I just submitted PR 100 to address this issue. Let me know your thoughts.

ghost commented 3 years ago

what is the status of this? it currently seems like it's not possible to integrate drizzle into an existing store. does this PR solve that issue?